Bug 18747: Select All in Add Patron Option in Patron Lists only selects the first 20 entries

This patch corrects the JavaScript functions for the "select all" and
"clear all" action when viewing patrons in a list. Before this
correction, checkboxes which were previously in hidden table rows would
not be checked.

To test, apply the patch and go to Patrons -> Patron Lists

- View a patron list
- If necessary, add multiple patrons to the list so that the number
  exceeds 20.
- Change the number of entries shown by the DataTable: Show [ 50 ]
  entries.
- Click "Select all." All visible checkboxes should be checked.
- Click "Clear all." All checkboxes should be unchecked.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2021-08-27 16:06:02 +00:00 committed by Jonathan Druart
parent e3c1b2068f
commit 63437e2572

View file

@ -219,17 +219,15 @@
patron_input_name: 'patrons_to_add'
});
var checkBoxes = $("input[type='checkbox']","#patron-list-table");
$("#CheckAll").click(function(e){
$("body").on("click", "#CheckAll", function(e){
e.preventDefault();
checkBoxes.each(function(){
$("input[type='checkbox']","#patron-list-table").each(function(){
$(this).prop("checked",1);
});
});
$("#CheckNone").click(function(e){
$("body").on("click", "#CheckNone", function(e){
e.preventDefault();
checkBoxes.each(function(){
$("input[type='checkbox']","#patron-list-table").each(function(){
$(this).prop("checked",0);
});
});