Bug 32447: Fix DataTable filtering when hidden columns are in place
The bibliographic record's details page in the Staff interface
includes a 'Holdings' table at the bottom with information for
each item attached to the record. When activating the filters
in this table, there is no input field for the barcode column
but just bold text.
This broke in v22.11.00, the related commit being
018a981b9b
from Bug 29282 where two new hidden columns were added to that
table.
We can fix this by taking advantage of the existing code in
koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc
(introduced by commit
dfb7af91af6 from Bug 23307) which allows
us to create and hook our own custom columnsInit() function in
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
to redraw the DataTable filters upon page load if a column is
marked as 'is_hidden: 1' in admin/columns_settings.yml, or if
a column is added/removed via the "⚙ Columns" button (both
are handled by the DataTables column-visibility.dt event).
Redrawing the filters via the above method also fixes the
issue described in Bug 32448.
Test plan:
1) Confirm the erratic DataTable behaviour outlined above
2) Apply this patch and reload all JS assets (hit CTRL-F5)
3) Confirm that you now see the correct input text field
for the 'Barcode' column
4) Confirm that you can search for barcodes or in any other
column successfully
5) Try toggling the visibility of the columns and making as
many search variations as possible -- it should all now
work without any glitches!
For extra credit ;-) you can also test the 'Other holdings'
table by setting the SeparateHoldings SysPref to 'Separate'.
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit
be81f156b884a33d501e9f882cf6c47c3642a0a7)
Signed-off-by: Jacob O'Mara <jacobomara901@gmail.com>