Bug 15285: Update common files
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / columns_settings.inc
1 [% USE ColumnsSettings %]
2
3 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/buttons.dataTables.min.css" />
4 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/dataTables.buttons.min.js"></script>
5 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/buttons.colVis.min.js"></script>
6
7 <script type="text/javascript">
8 function KohaTable(selector, dt_parameters, columns_settings) {
9     var id = 0;
10     var hidden_ids = [];
11     var included_ids = [];
12     $(columns_settings).each( function() {
13         var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( 'th' );
14         var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : id;
15         if ( used_id == -1 ) return;
16
17         if ( this['is_hidden'] == "1" ) {
18             hidden_ids.push( used_id );
19         }
20         if ( this['cannot_be_toggled'] == "0" ) {
21             included_ids.push( used_id );
22         }
23         id++;
24     });
25     dt_parameters[ "buttons" ] = [
26         {
27             extend: 'colvis',
28             columns: included_ids,
29         }
30     ];
31     var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
32
33     $(hidden_ids).each(function(index, value) {
34         table.fnSetColumnVis( value, false );
35     });
36
37     return table;
38 }
39
40 </script>