From d4fec141234da85bab738f932fa140938b1ded2c Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Fri, 1 Mar 2019 12:17:44 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B01443:=20Handle=20disabled=20selectable?= =?UTF-8?q?=20rows=20in=20datatables=20when=20"All=20checking/unchecking"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/jquery.tablesorter.pager.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/js/jquery.tablesorter.pager.js b/js/jquery.tablesorter.pager.js index 458594e1b..874fe289d 100644 --- a/js/jquery.tablesorter.pager.js +++ b/js/jquery.tablesorter.pager.js @@ -90,7 +90,7 @@ function sprintf(format, etc) { function checkAll(table, pager, value) { // Mark all the displayed items as check or unchecked depending on the value - $(table).find(':checkbox[name^=selectObj]').prop('checked', value); + $(table).find(':checkbox[name^=selectObj]:not([disabled])').prop('checked', value); // Set the 'selectionMode' for the future objects to load if (value) { @@ -103,6 +103,7 @@ function sprintf(format, etc) { $(pager).find(':input[name=selectionMode]').val(table.config.selectionMode); // Reset the list of saved selection... resetStoredSelection(pager); + $(table).find(':checkbox[name^=selectObj]').trigger("change"); updateCounter(table, pager); return true; } @@ -112,7 +113,7 @@ function sprintf(format, etc) { $(':input[name^=storedSelection]', pager).remove(); } - function storeSelection(table, pager, id, value) + function storeSelection(table, pager, id, value, disabled=false) { var valueToStore = value; if (table.config.selectionMode == 'negative') @@ -127,7 +128,7 @@ function sprintf(format, etc) { } if ($('#'+id, pager).length ==0) { - $(pager).append($('')); + $(pager).append($('')); } } else @@ -254,33 +255,33 @@ function sprintf(format, etc) { if (c.selectionMode == 'negative') { - $(table).find(':checkbox[name^=selectObj]').prop('checked', true);; + $(table).find(':checkbox[name^=selectObj]:not([disabled])').prop('checked', true); } if (table.config.select_mode == 'multiple') { - $(table).find(':checkbox[name^=selectObj]').each(function() { + $(table).find(':checkbox[name^=selectObj]:not([disabled])').each(function() { var id = parseInt(this.value, 10); if ($('#'+id, table.config.container).length > 0) { if (c.selectionMode == 'positive') { - $(this).prop('checked', true);; + $(this).prop('checked', true); } else { - $(this).prop('checked', false);; + $(this).prop('checked', false); } } }); $(table).find(':checkbox[name^=selectObj]').change(function() { - storeSelection(table, table.config.container, this.value, this.checked); - }); + storeSelection(table, table.config.container, this.value, this.checked, this.disabled); + }).trigger("change"); } else if (table.config.select_mode == 'single') { - $(table).find('input[name^=selectObject]:radio').each(function() { + $(table).find('input[name^=selectObject]:radio:not([disabled])').each(function() { var id = parseInt(this.value, 10); if ($('#'+id, table.config.container).length > 0) {