From 0a8490d606cd108fffae388c4098d7f2df214010 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Tue, 25 Feb 2014 00:10:53 +1100 Subject: [PATCH] Adjusted select all checkbox activation to include list type --- assets/js/admin.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/assets/js/admin.js b/assets/js/admin.js index 5353f83e..755c7e20 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -176,17 +176,20 @@ jQuery(document).ready(function($){ }); // Check if all checkboxes are checked already - $(".sp-data-table").on("checkCheck", function() { + $(".sp-select-all-range").on("checkCheck", function() { $(this).each(function() { - $(this).find("thead .sp-select-all").prop("checked", $(this).find("tbody input[type=checkbox]:checked").length == $(this).find("tbody input[type=checkbox]").length); + $(this).find(".sp-select-all").prop("checked", $(this).find("input[type=checkbox]:checked:not(.sp-select-all)").length == $(this).find("input[type=checkbox]:visible:not(.sp-select-all)").length); }); }); // Activate check check when a checkbox is checked - $(".sp-data-table tbody input[type=checkbox]").change(function() { - $(this).closest(".sp-data-table").trigger("checkCheck"); + $(".sp-select-all-range input[type=checkbox]:not(.sp-select-all)").change(function() { + $(this).closest(".sp-select-all-range").trigger("checkCheck"); }); + // Activate check check on page load + $(".sp-select-all-range").trigger("checkCheck"); + // Trigger check check $(".sp-data-table").trigger("checkCheck");