Jonathan Druart
48d14b7966
The "Column visibility" text button was not translatable, now it is. Test plan: 1/ Update the template for a given language and translate the "Column visibility" string 2/ Go on admin/currency.pl => The string should be translated. Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
[% USE ColumnsSettings %]
|
|
|
|
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/buttons.dataTables.min.css" />
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/dataTables.buttons.min.js"></script>
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/buttons.colVis.min.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
function KohaTable(selector, dt_parameters, columns_settings) {
|
|
var id = 0;
|
|
var hidden_ids = [];
|
|
var included_ids = [];
|
|
$(columns_settings).each( function() {
|
|
var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( 'th' );
|
|
var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : id;
|
|
if ( used_id == -1 ) return;
|
|
|
|
if ( this['is_hidden'] == "1" ) {
|
|
hidden_ids.push( used_id );
|
|
}
|
|
if ( this['cannot_be_toggled'] == "0" ) {
|
|
included_ids.push( used_id );
|
|
}
|
|
id++;
|
|
});
|
|
dt_parameters[ "buttons" ] = [
|
|
{
|
|
extend: 'colvis',
|
|
columns: included_ids,
|
|
text: _('Column visibility'),
|
|
}
|
|
];
|
|
var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters));
|
|
|
|
$(hidden_ids).each(function(index, value) {
|
|
table.fnSetColumnVis( value, false );
|
|
});
|
|
|
|
return table;
|
|
}
|
|
|
|
</script>
|