Lines 350-377
Link Here
|
350 |
parent_block.find(".info").hide(); |
350 |
parent_block.find(".info").hide(); |
351 |
parent_block.find(".error").hide(); |
351 |
parent_block.find(".error").hide(); |
352 |
|
352 |
|
353 |
// Build the aLengthMenu |
353 |
// Build the lengthMenu |
354 |
let aLengthMenu = [ |
354 |
let lengthMenu = dataTablesDefaults.lengthMenu; |
355 |
...new Set([[% Koha.Preference('PatronsPerPage') | html %], 10, 20, 50, 100, -1]) |
355 |
let patronsPerPage = [% Koha.Preference('PatronsPerPage') || '20' | html %] |
356 |
]; |
356 |
// Merge, remove -1, sort, add -1 |
357 |
aLengthMenu.sort(function( a, b ){ |
357 |
lengthMenu = [...new Set(lengthMenu.concat(patronsPerPage).filter(v => v !== -1))].sort((a, b) => a - b).concat(-1); |
358 |
// Put "All" at the end |
|
|
359 |
if ( a == -1 ) { |
360 |
return 1; |
361 |
} else if ( b == -1 ) { |
362 |
return -1; |
363 |
} |
364 |
return parseInt(a) < parseInt(b) ? -1 : 1;} |
365 |
); |
366 |
let aLengthMenuLabel = []; |
367 |
$(aLengthMenu).each(function(){ |
368 |
if ( this == -1 ) { |
369 |
// Label for -1 is "All" |
370 |
aLengthMenuLabel.push(_("All")); |
371 |
} else { |
372 |
aLengthMenuLabel.push(this); |
373 |
} |
374 |
}); |
375 |
|
358 |
|
376 |
let additional_filters = { |
359 |
let additional_filters = { |
377 |
surname: function(){ |
360 |
surname: function(){ |
Lines 774-782
Link Here
|
774 |
'embed': [% To.json(embed) | $raw %], |
757 |
'embed': [% To.json(embed) | $raw %], |
775 |
"order": [[ [% order_column_index | html %], "asc" ]], |
758 |
"order": [[ [% order_column_index | html %], "asc" ]], |
776 |
"autoWidth": false, |
759 |
"autoWidth": false, |
777 |
'lengthMenu': [aLengthMenu, aLengthMenuLabel], |
760 |
lengthMenu, |
|
|
761 |
pageLength: patronsPerPage, |
778 |
"pagingType": 'full_numbers', |
762 |
"pagingType": 'full_numbers', |
779 |
"pageLength": [% Koha.Preference('PatronsPerPage') | html %], |
|
|
780 |
[% IF sticky_header %] |
763 |
[% IF sticky_header %] |
781 |
"initComplete": function(settings, json) { |
764 |
"initComplete": function(settings, json) { |
782 |
$("#[% sticky_header | html %]").show(); |
765 |
$("#[% sticky_header | html %]").show(); |