Bug 28096: Fix table settings for API datatables wrapper

Bug 25287 added the table settings to the API datatables wrapper but it does not
handled correctly the hidden columns.

Test plan:
Go to Home > Administration > Table settings
Administration > libraries
Tick "Is hidden by default" for "library_address"
Go to Home > Administration > Libraries
Click Columns and check the "Address" column, it must be hidden

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-04-06 17:56:17 +02:00
parent c285de9802
commit 1dcab58642

View file

@ -773,6 +773,15 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
var table = $(this).dataTable(settings);
table.DataTable().on("column-visibility.dt", function(){
if( typeof columnsInit == 'function' ){
// This function can be created separately and used to trigger
// an event after the DataTable has loaded AND column visibility
// has been updated according to the table's configuration
columnsInit();
}
}).columns( hidden_ids ).visible( false );
if ( add_filters ) {
var table_dt = table.DataTable();
$(this).find('thead tr:eq(1) th').each( function (i) {