1 [% USE ColumnsSettings %]
3 <script type="text/javascript">
4 function KohaTable(id_selector, dt_parameters, columns_settings, add_filters) {
8 var selector = '#' + id_selector;
10 $(columns_settings).each( function() {
11 var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( 'th' );
12 var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : counter;
13 if ( used_id == -1 ) return;
15 if ( this['is_hidden'] == "1" ) {
16 hidden_ids.push( used_id );
18 if ( this['cannot_be_toggled'] == "0" ) {
19 included_ids.push( used_id );
23 dt_parameters[ "buttons" ] = [
26 columns: included_ids,
27 text: _("Column visibility"),
31 var table = $(selector);
33 // Duplicate the table header row for columnFilter
34 thead_row = table.find('thead tr');
35 clone = thead_row.clone().addClass('filters_row');
36 clone.find("th.NoSort").html('');
37 thead_row.before(clone);
40 table.dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
42 $(hidden_ids).each(function(index, value) {
43 table.fnSetColumnVis( value, false );
47 // show a link to activate filtering
50 .attr('id', id_selector + '_activate_filters');
51 $("." + id_selector + "_table_controls").prepend(link);
52 deactivate_filters(id_selector);