Koha/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc
Jonathan Druart b77a1c794f Bug 10212: Move colvis files to the include file
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Implements the option to change the default columns that appear in
a table while giving the user the option to change the columns
individually for a session.

As an example, this feature is implemented for the currencies table.

Works well for all possible combinations in configuration.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-26 09:28:58 -03:00

30 lines
935 B
PHP

[% USE ColumnsSettings %]
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.colvis.css" />
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.colvis.js"></script>
<script type="text/javascript">
function KohaTable(selector, dt_parameters, columns_settings) {
var id = 0;
var hidden_ids = [];
var excluded_ids = [];
$(columns_settings).each( function() {
if ( this['is_hidden'] == "1" ) {
hidden_ids.push( id );
}
if ( this['cannot_be_toggled'] == "1" ) {
excluded_ids.push( id );
}
id++;
});
dt_parameters[ "oColVis" ] = { "aiExclude": excluded_ids };
var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
$(hidden_ids).each(function(index, value) {
table.fnSetColumnVis( value, false );
});
return table;
}
</script>