[Koha-bugs] [Bug 24561] Add embedded column order by and filter features to datatables api wrapper
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Mar 4 14:57:49 CET 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24561
Kyle M Hall <kyle at bywatersolutions.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #100039|0 |1
is obsolete| |
--- Comment #8 from Kyle M Hall <kyle at bywatersolutions.com> ---
Created attachment 100126
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=100126&action=edit
Bug 24561: Datatables api wrapper also 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>
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list