diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index 9a1db9f781..90d80fca34 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -120,6 +120,24 @@ } } + function update_columns_visibility(settings){ + let table = settings.oInstance.api(); + table.columns().visible(true); + table.columns().every(function(i){ + let is_empty = true; + let nodes = this.nodes(); + nodes.each((td, ii) => { + if ( $(td).html() !== '' ) { + is_empty = false; + return; + } + }); + if ( is_empty ) { + table.columns(i).visible(false); + } + }); + } + $(document).ready(function() { $(".SelectAll").on("click",function(e){ @@ -779,20 +797,6 @@ [% END %] ], initComplete: function( settings, json ){ - let table = settings.oInstance.api(); - table.columns().every(function(i){ - let is_empty = true; - let nodes = this.nodes(); - nodes.each((td, ii) => { - if ( $(td).html() !== '' ) { - is_empty = false; - return; - } - }); - if ( is_empty ) { - table.columns(i).visible(false); - } - }); [% IF StaffDetailItemSelection %] itemSelectionBuildActionLinks(tab_id); [% END %] @@ -835,6 +839,8 @@ }); [% END %] + update_columns_visibility(settings); + if ( drawcallback ) { drawcallback(this); } }, [% END %]