Bug 17014 - Remove more event attributes from patron templates
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / columns_settings.inc
1 [% USE ColumnsSettings %]
2
3 <script type="text/javascript">
4 function KohaTable(selector, dt_parameters, columns_settings) {
5     var id = 0;
6     var hidden_ids = [];
7     var included_ids = [];
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;
12
13         if ( this['is_hidden'] == "1" ) {
14             hidden_ids.push( used_id );
15         }
16         if ( this['cannot_be_toggled'] == "0" ) {
17             included_ids.push( used_id );
18         }
19         id++;
20     });
21     dt_parameters[ "buttons" ] = [
22         {
23             extend: 'colvis',
24             columns: included_ids,
25             text: _("Column visibility"),
26         }
27     ];
28     var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
29
30     $(hidden_ids).each(function(index, value) {
31         table.fnSetColumnVis( value, false );
32     });
33
34     return table;
35 }
36
37 </script>