Bug 35068: (follow-up): Make sure renew/checkin selections get retained on reload

To test:
1. Have two checkouts. Click one for Renew and one for Checkin. Click on Check in selected items.
2. When the table reloads the 'renew' selections should be retained
3. Have two checkouts. Click one for Renew and one for Checkin. Click on Renew selected items.
4. When the table reloads the 'check in' selections should be retained

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lucas Gass 2023-11-03 15:24:49 +00:00 committed by Tomas Cohen Arazi
parent e86264606b
commit 41daf4db99
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 21 additions and 2 deletions

View File

@ -249,7 +249,6 @@ $(document).ready(function() {
if ( refresh_table ) {
RefreshIssuesTable();
}
$('#RenewChecked, #CheckinChecked').prop('disabled' , true );
// Prevent form submit
return false;
});
@ -297,7 +296,27 @@ $(document).ready(function() {
function RefreshIssuesTable() {
var table = $('#issues-table').DataTable();
table.ajax.reload();
var renewchecked = $('input[name=renew]:checked').map(function(){
return this.value;
}).get();
var checkinchecked = $('input[name=checkin]:checked').map(function(){
return this.value;
}).get();
table.ajax.reload( function() {
$('#RenewChecked, #CheckinChecked').prop('disabled' , true );
if ( renewchecked.length ) {
$('#RenewChecked').prop('disabled' , false );
renewchecked.forEach( function(checked) {
$('.renew[value="'+checked+'"]').prop('checked' , true );
});
}
if ( checkinchecked.length ) {
$('#CheckinChecked').prop('disabled' , false );
checkinchecked.forEach( function(checked) {
$('.checkin[value="'+checked+'"]').prop('checked' , true );
});
}
});
}
function LoadIssuesTable() {