var included_ids = [];
var selector = '#' + id_selector;
- var columns_settings = table_settings['columns'];
+ if ( table_settings ) {
+ var columns_settings = table_settings['columns'];
- $(columns_settings).each( function() {
- var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( selector + ' th' );
- var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : counter;
- if ( used_id == -1 ) return;
+ $(columns_settings).each( function() {
+ var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( selector + ' th' );
+ var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : counter;
+ 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 );
- }
- counter++;
- });
+ if ( this['is_hidden'] == "1" ) {
+ hidden_ids.push( used_id );
+ }
+ if ( this['cannot_be_toggled'] == "0" ) {
+ included_ids.push( used_id );
+ }
+ counter++;
+ });
+ }
var exportColumns = ":visible:not(.noExport)";
var exportRows = ":visible:not(.noExport)";
});
}
- if ( table_settings.hasOwnProperty('default_display_length') && table_settings['default_display_length'] != null ) {
- new_parameters["pageLength"] = table_settings['default_display_length'];
- }
- if ( table_settings.hasOwnProperty('default_sort_order') && table_settings['default_sort_order'] != null ) {
- new_parameters["order"] = [[ table_settings['default_sort_order'], 'asc' ]];
+ if ( table_settings ) {
+ if ( table_settings.hasOwnProperty('default_display_length') && table_settings['default_display_length'] != null ) {
+ new_parameters["pageLength"] = table_settings['default_display_length'];
+ }
+ if ( table_settings.hasOwnProperty('default_sort_order') && table_settings['default_sort_order'] != null ) {
+ new_parameters["order"] = [[ table_settings['default_sort_order'], 'asc' ]];
+ }
}
table.dataTable(new_parameters);
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function() {
- var columns_settings = []; // Empty because there are no columns we want to be configurable
KohaTable("categoriest", {
"aaSorting": [[ 0, "asc" ]],
"sPaginationType": "full"
- }, columns_settings);
+ });
if ( $("#branches option:selected").length < 1 ) {
$("#branches option:first").attr("selected", "selected");