[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 Feb 19 15:35:25 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24561

Agustín Moyano <agustinmoyano at theke.io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #99254|0                           |1
        is obsolete|                            |

--- Comment #4 from Agustín Moyano <agustinmoyano at theke.io> ---
Created attachment 99255
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99255&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.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list