[Koha-bugs] [Bug 24561] Add a datatables API wrapper
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed May 6 16:11:59 CEST 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24561
Jonathan Druart <jonathan.druart at bugs.koha-community.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #103727|0 |1
is obsolete| |
Attachment #104037|0 |1
is obsolete| |
Attachment #104384|0 |1
is obsolete| |
--- Comment #16 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Created attachment 104424
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=104424&action=edit
Bug 24561: Add a Datatables api wrapper that implements filter and order
embedded columns
This patch adds the ability to filter and order by embedded columns.
To use it you must in JS:
$('datatable_selector').api({datatables_options})
where datatables_options are all datatables options plus:
1. embed: [list of embeddable tables]
This option adds x-koha-embed header to request.
2. header_filter: true|false
This option if true sets x-koha-query header with stringyfied json of
filters
Oderable and searchable columns must define data option as string, otherwise
filter and order won't be possible.
If you must custom the output, use the render function.
For example:
* Don't
> $('.table_selector').api({
> columns: [
> {
> data: function(row, type, val, meta) {
> return '<a href="'+row.link+'">'+row.holds.patron.firstname+'</a>';
> },
> orderable: true,
> searchable: true
> }
> ]
> });
* Do
> $('.table_selector').api({
> columns: [
> {
> data: 'holds.patron.firstname',
> render: function(row, type, val, meta) {
> return '<a href="'+row.link+'">'+row.holds.patron.firstname+'</a>';
> },
> orderable: true,
> searchable: true
> }
> ]
> });
To test you must implement and test bug 20936, where it will be used.
Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen at theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart at bugs.koha-community.org>
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list