Bug 24561 added a wrapper to use easily all the DataTables functionalities when a REST API route was used within Koha. The filtering method used is working for the global search filter, but not if we have a filter on top of each column.
Created attachment 115051 [details] [review] Bug 27402: Add DT column filtering to the cities admin page Bug 24561 added a wrapper to use easily all the DataTables functionalities when a REST API route was used within Koha. The filtering method used is working for the global search filter, but not if we have a filter on top of each column. This patchset is going to, first, add the filters on top of each column of the cities table, then the code will be moved to the DT REST API wrapper to make it reusable easily. Test plan: Generate some cities: use Koha::Cities; for ( 1 .. 42 ) { Koha::City->new({city_name => "name_$_", city_state => "state_$_", city_country => "country_$_", city_zipcode => "zipcode_$_" })->store; } Hit /admin/cities.pl Use the filters The general filter must do a OR query on each of the cities' attributes, when column filters must use AND
Created attachment 115052 [details] [review] Bug 27402: Move to datatables.js To make it reusable we need to move the code to datatables.js So far only the cities table is using the column filters so there is no other view to test. Note that the existing implementation didn't work at all, and were base on what is done on the detail.pl page (using table_filters.js)
Created attachment 115053 [details] [review] add fixedHeader
Created attachment 115054 [details] [review] Bug 27402: Column filters must AND, not OR Test plan: Use the column filters and the global filter Confirm that the rows are filtered as you expect QA Note: There is more code on top of this, see bug 20212.
I can't say I'm impressed by your skills, Jonathan. But this is super cool.
Created attachment 115813 [details] [review] Bug 27402: Add DT column filtering to the cities admin page Bug 24561 added a wrapper to use easily all the DataTables functionalities when a REST API route was used within Koha. The filtering method used is working for the global search filter, but not if we have a filter on top of each column. This patchset is going to, first, add the filters on top of each column of the cities table, then the code will be moved to the DT REST API wrapper to make it reusable easily. Test plan: Generate some cities: use Koha::Cities; for ( 1 .. 42 ) { Koha::City->new({city_name => "name_$_", city_state => "state_$_", city_country => "country_$_", city_zipcode => "zipcode_$_" })->store; } Hit /admin/cities.pl Use the filters The general filter must do a OR query on each of the cities' attributes, when column filters must use AND Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 115814 [details] [review] Bug 27402: Move to datatables.js To make it reusable we need to move the code to datatables.js So far only the cities table is using the column filters so there is no other view to test. Note that the existing implementation didn't work at all, and were base on what is done on the detail.pl page (using table_filters.js) Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 115815 [details] [review] Bug 27402: Column filters must AND, not OR Test plan: Use the column filters and the global filter Confirm that the rows are filtered as you expect QA Note: There is more code on top of this, see bug 20212. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(In reply to Tomás Cohen Arazi from comment #5) > I can't say I'm impressed by your skills, Jonathan. But this is super cool. This tried to mean I'm already used to seeing you do smart things :-D
Created attachment 115935 [details] [review] Bug 27402: Add DT column filtering to the cities admin page Bug 24561 added a wrapper to use easily all the DataTables functionalities when a REST API route was used within Koha. The filtering method used is working for the global search filter, but not if we have a filter on top of each column. This patchset is going to, first, add the filters on top of each column of the cities table, then the code will be moved to the DT REST API wrapper to make it reusable easily. Test plan: Generate some cities: use Koha::Cities; for ( 1 .. 42 ) { Koha::City->new({city_name => "name_$_", city_state => "state_$_", city_country => "country_$_", city_zipcode => "zipcode_$_" })->store; } Hit /admin/cities.pl Use the filters The general filter must do a OR query on each of the cities' attributes, when column filters must use AND Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 115936 [details] [review] Bug 27402: Move to datatables.js To make it reusable we need to move the code to datatables.js So far only the cities table is using the column filters so there is no other view to test. Note that the existing implementation didn't work at all, and were base on what is done on the detail.pl page (using table_filters.js) Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 115937 [details] [review] Bug 27402: Column filters must AND, not OR Test plan: Use the column filters and the global filter Confirm that the rows are filtered as you expect QA Note: There is more code on top of this, see bug 20212. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This is really nice, and clearly well thought through. Passing QA
Created attachment 115942 [details] [review] Bug 27402: Reverse search filter texts
Created attachment 115966 [details] [review] Bug 27402: Reverse search filter texts
Pushed to master for 21.05, thanks to everybody involved!
Enhancement not pushed to 20.11.x