@@ -, +, @@ patroncards/add_user_search (common/patron_search.tt). observe that that value is not in the per page drop down. and that value is selected by default. PatronsPerPage system preference. --- .../prog/en/modules/common/patron_search.tt | 19 ++++++++++- .../prog/en/modules/members/member.tt | 32 +++++++------------ .../prog/en/modules/patroncards/edit-batch.tt | 18 +++++++++++ 3 files changed, 48 insertions(+), 21 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt @@ -130,6 +130,21 @@ search = 0; [% END %] + // Prepare DataTables settings + var aLengthMenu = [10, 20, 50, 100, -1]; + var aLengthMenuLabel = [10, 20, 50, 100, _("All")]; + var patronsPerPage = [% Koha.Preference('PatronsPerPage') | html %]; + for ( var i = 0; i < aLengthMenu.length; i++ ) { + if ( aLengthMenu[i] == patronsPerPage ) { + break; + } + if ( aLengthMenu[i] > patronsPerPage || aLengthMenu[i] == -1 ) { + aLengthMenu.splice(i, 0, patronsPerPage); + aLengthMenuLabel.splice(i, 0, patronsPerPage); + break; + } + } + // Apply DataTables on the results table dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, { 'bServerSide': true, @@ -214,7 +229,9 @@ ], 'bAutoWidth': false, 'sPaginationType': 'full_numbers', - "iDisplayLength": [% Koha.Preference('PatronsPerPage') | html %], + 'aLengthMenu': [aLengthMenu, aLengthMenuLabel], + 'iDisplayLength': patronsPerPage, + 'pageLength': patronsPerPage, 'aaSorting': [[[% aaSorting || 0 | html %], 'asc']], 'bFilter': false, 'bProcessing': true, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -363,28 +363,19 @@ [% END %] // Build the aLengthMenu - var aLengthMenu = [ - [% PatronsPerPage | html %], 10, 20, 50, 100, -1 - ]; - jQuery.unique(aLengthMenu); - aLengthMenu.sort(function( a, b ){ - // Put "All" at the end - if ( a == -1 ) { - return 1; - } else if ( b == -1 ) { - return -1; + var aLengthMenu = [10, 20, 50, 100, -1]; + var aLengthMenuLabel = [10, 20, 50, 100, _("All")]; + var patronsPerPage = [% PatronsPerPage | html %]; + for ( var i = 0; i < aLengthMenu.length; i++ ) { + if ( aLengthMenu[i] == patronsPerPage ) { + break; } - return parseInt(a) < parseInt(b) ? -1 : 1;} - ); - var aLengthMenuLabel = []; - $(aLengthMenu).each(function(){ - if ( this == -1 ) { - // Label for -1 is "All" - aLengthMenuLabel.push(_("All")); - } else { - aLengthMenuLabel.push(this); + if ( aLengthMenu[i] > patronsPerPage || aLengthMenu[i] == -1 ) { + aLengthMenu.splice(i, 0, patronsPerPage); + aLengthMenuLabel.splice(i, 0, patronsPerPage); + break; } - }); + } // Apply DataTables on the results table var columns_settings = [% TablesSettings.GetColumns( 'members', 'member', 'memberresultst', 'json' ) | $raw %]; @@ -491,6 +482,7 @@ "aLengthMenu": [aLengthMenu, aLengthMenuLabel], 'sPaginationType': 'full_numbers', "iDisplayLength": [% PatronsPerPage | html %], + "pageLength": [% PatronsPerPage | html %], "bProcessing": true, "initComplete": function(settings, json) { Sticky = $("#searchheader"); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt @@ -245,6 +245,21 @@ }; $(document).ready(function() { + // Prepare DataTables settings + var aLengthMenu = [10, 20, 50, 100, -1]; + var aLengthMenuLabel = [10, 20, 50, 100, _("All")]; + var patronsPerPage = [% Koha.Preference('PatronsPerPage') | html %]; + for ( var i = 0; i < aLengthMenu.length; i++ ) { + if ( aLengthMenu[i] == patronsPerPage ) { + break; + } + if ( aLengthMenu[i] > patronsPerPage || aLengthMenu[i] == -1 ) { + aLengthMenu.splice(i, 0, patronsPerPage); + aLengthMenuLabel.splice(i, 0, patronsPerPage); + break; + } + } + [% IF table_loop %] $("#description").show(); [% ELSE %] @@ -256,6 +271,9 @@ ], "aaSorting": [[ 0, "asc" ]], "sPaginationType": "full", + "aLengthMenu": [aLengthMenu, aLengthMenuLabel], + "iDisplayLength": patronsPerPage, + "pageLength": patronsPerPage, "autoWidth": false })); $("#additems").click(function(){ --