PDA

View Full Version : [UNKNOWN][3.??] checkchange event of a treepanel has some bug.



punit
5 Jan 2010, 12:44 AM
Problem : I need to enable a submit button when any checkbox node of a treepanel is clicked and disable if none of the checkboxes of the treepanel is clicked.

For that I had maintained a counter (totalCheckedNodes) that will keep the count of number of the checked nodes in the treepanel. If this counter==0, than disable the submit button if counter>0 enable the submit button.

Listener used: checkchange on the treepanel.
and counter maintained in this listeners body. But this checkchange event has some bug, sometimes it does not reflect the true status of the treenode if I click continuously on the treenode.
like: on continuously clicking on a node it fires checkchange(node, false), means node has been unchecked but on GUI node remains checked, that means my counter integrity breaks here and submit button disable even if checkbox is in checked status.

And sometimes it fires same status twice like:
checkchange(node, false) than again checkchange(node,false), so how check is changed here.