1 [% USE ColumnsSettings %]
3 <script type="text/javascript">
4 function KohaTable(id_selector, dt_parameters, columns_settings, add_filters) {
8 $(columns_settings).each( function() {
9 var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( 'th' );
10 var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : id;
11 if ( used_id == -1 ) return;
13 if ( this['is_hidden'] == "1" ) {
14 hidden_ids.push( used_id );
16 if ( this['cannot_be_toggled'] == "0" ) {
17 included_ids.push( used_id );
21 dt_parameters[ "buttons" ] = [
24 columns: included_ids,
25 text: _("Column visibility"),
29 var table = $('#' + id_selector + ' table');
31 // Duplicate the table header row for columnFilter
32 thead_row = table.find('thead tr');
33 clone = thead_row.clone().addClass('filters_row');
34 clone.find("th.NoSort").html('');
35 thead_row.before(clone);
38 table.dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
40 $(hidden_ids).each(function(index, value) {
41 table.fnSetColumnVis( value, false );
45 // show a link to activate filtering
48 .attr('id', id_selector + '_activate_filters');
49 $("." + id_selector + "_table_controls").prepend(link);
50 deactivate_filters(id_selector);