Bug 10212: Columns configuration for tables
[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 excluded_ids = [];
8     $(columns_settings).each( function() {
9         if ( this['is_hidden'] == "1" ) {
10             hidden_ids.push( id );
11         }
12         if ( this['cannot_be_toggled'] == "1" ) {
13             excluded_ids.push( id );
14         }
15         id++;
16     });
17     dt_parameters[ "oColVis" ] = { "aiExclude": excluded_ids };
18     var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
19
20     $(hidden_ids).each(function(index, value) {
21         table.fnSetColumnVis( value, false );
22     });
23
24     return table;
25 }
26
27 </script>