diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 18357f5b95..729fa8e47e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -791,14 +791,6 @@ 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(); @@ -828,6 +820,15 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { } ); } + 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 ); + return table; };