How would I stop a click event from a label associated to a checkbox if the checkbox is indeterminate?
I have attempted the following, but to no avail:
el.parent().find('.arena-custom-label').click(function ( event ) {
if (el.is(':indeterminate')) {
event.preventDefault();
el.attr('indeterminate', false);
el.removeClass('indeterminate');
dataGrid.find('.ag.gr:checked').trigger('click');
} else {
el.change(function () {
if (el.is(':checked')) {
dataGrid.find('tbody .ag.gr:not(:checked)').trigger('click');
} else {
dataGrid.find('tbody .ag.gr:checked').trigger('click');
}
});
}
});
el being the checkbox itself.
The goal is while this check box is indeterminate, upon the associated label click all I want it to do is go out of indeterminate and to unchecked. Then I will trigger all checked checkboxes in a table to go unchecked as well.
The problem is that when I click the indeterminate checkbox label, it causes it to go checked resulting in all unchecked checkboxes to go checked. The opposite of what I want.