Fix select all checkbox behavior

This commit is contained in:
Brian Miyaji
2014-06-21 13:05:43 +10:00
parent c128aeb447
commit 885fe21a41

View File

@@ -49,22 +49,24 @@ jQuery(document).ready(function($){
filter += ".sp-filter-"+filterval; filter += ".sp-filter-"+filterval;
}); });
} }
$panel = $(this).closest(".sp-tab-select").siblings(".sp-tab-panel") $panel = $(this).closest(".sp-tab-select").siblings(".sp-tab-panel");
$panel.find(".sp-post").hide(0, function() { $panel.each(function() {
$(this).find("input").prop("disabled", true); $(this).find(".sp-post").hide(0, function() {
$(this).filter(filter).show(0, function() { $(this).find("input").prop("disabled", true);
$(this).find("input").prop("disabled", false); $(this).filter(filter).show(0, function() {
$(this).find("input").prop("disabled", false);
});
}); });
if($(this).find(".sp-post:visible").length > 0) {
$(this).find(".sp-select-all-container").show();
$(this).find(".sp-show-all-container").show();
$(this).find(".sp-not-found-container").hide();
} else {
$(this).find(".sp-select-all-container").hide();
$(this).find(".sp-show-all-container").hide();
$(this).find(".sp-not-found-container").show();
}
}); });
if($panel.find(".sp-post:visible").length > 0) {
$panel.find(".sp-select-all-container").show();
$panel.find(".sp-show-all-container").show();
$panel.find(".sp-not-found-container").hide();
} else {
$panel.find(".sp-select-all-container").hide();
$panel.find(".sp-show-all-container").hide();
$panel.find(".sp-not-found-container").show();
}
}); });
// Trigger tab filter // Trigger tab filter
@@ -77,7 +79,7 @@ jQuery(document).ready(function($){
// Show all filter // Show all filter
$(".sp-tab-panel").on("click", ".sp-show-all", function() { $(".sp-tab-panel").on("click", ".sp-show-all", function() {
$(this).closest("li").hide().siblings(".sp-post").show().find("input").prop("disabled", false); $(this).closest("li").hide().siblings(".sp-post, .sp-select-all-container").show().find("input").prop("disabled", false);
}); });
// Self-cloning // Self-cloning
@@ -231,7 +233,7 @@ jQuery(document).ready(function($){
// Check if all checkboxes are checked already // Check if all checkboxes are checked already
$(".sp-select-all-range").on("checkCheck", function() { $(".sp-select-all-range").on("checkCheck", function() {
$(this).each(function() { $(this).each(function() {
$(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); $(this).find(".sp-select-all").prop("checked", $(this).find("input[type=checkbox]:checked:not(.sp-select-all)").length != 0 && $(this).find("input[type=checkbox]:checked:not(.sp-select-all)").length == $(this).find("input[type=checkbox]:visible:not(.sp-select-all)").length);
}); });
}); });