I have a tree view with check boxes. I am using the checkChildren property to select the children.
I have a bit of code to say how many items are checked. All check boxes have treecheckbox, but only the leaf nodes have itemnode.
I have a bit of code to say how many items are checked. All check boxes have treecheckbox, but only the leaf nodes have itemnode.
$(".treecheckbox").change(function () {
$("#selected-count").html("Recorded Selected: " + $("#treeview input.itemnode").serializeArray().length);
});
The figures come out fine when you click on the leaf nodes. However if you select any of the parent nodes, the count get off. Both the click and the change event for the check boxes fire before the event to update the child nodes. So If I have no records selected and click a parent that auto selects 5 then the query returns zero until something else fires the event and then the count it right.
Is there any post update event for the check boxes that I can wire to in order to run after that update process fires?
Alternatively, perhaps I am doing it the hard way. Is there a better way of handling it?
Thanks
Randy
The figures come out fine when you click on the leaf nodes. However if you select any of the parent nodes, the count get off. Both the click and the change event for the check boxes fire before the event to update the child nodes. So If I have no records selected and click a parent that auto selects 5 then the query returns zero until something else fires the event and then the count it right.
Is there any post update event for the check boxes that I can wire to in order to run after that update process fires?
Alternatively, perhaps I am doing it the hard way. Is there a better way of handling it?
Thanks
Randy