more tweaks to selection javascript but still has select all bug

This commit is contained in:
James Tauber 2012-09-06 22:54:52 -04:00
parent 3dd7468365
commit 4435d957fc

View file

@ -62,10 +62,6 @@
var options = $.extend({}, $.fn.actions.defaults, opts); var options = $.extend({}, $.fn.actions.defaults, opts);
var actionCheckboxes = $(this); var actionCheckboxes = $(this);
checker = function(checked) { checker = function(checked) {
if (checked) {
} else {
reset();
}
$(actionCheckboxes).attr("checked", checked) $(actionCheckboxes).attr("checked", checked)
.parent().parent().toggleClass(options.selectedClass, checked); .parent().parent().toggleClass(options.selectedClass, checked);
} }
@ -81,17 +77,12 @@
return value; return value;
}); });
} }
reset = function() {
$(options.counterContainer).show();
}
// Show counter by default
$(options.counterContainer).show();
// Check state of checkboxes and reinit state if needed // Check state of checkboxes and reinit state if needed
$(this).filter(":checked").each(function(i) { $(this).filter(":checked").each(function(i) {
$(this).parent().parent().toggleClass(options.selectedClass); $(this).parent().parent().toggleClass(options.selectedClass);
updateCounter(); updateCounter();
}); });
$(options.allToggle).show().click(function() { $(options.allToggle).click(function() {
checker($(this).attr("checked")); checker($(this).attr("checked"));
updateCounter(); updateCounter();
}); });