We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

TreeView and too many events?

I am using the TreeView with "interactive checkboxes. When I check a child node, the parent node will be also be set or partially set. This is working great! However, if I check a child node, I am getting the AfterCheck event multiple times. I really only need it once. The problem is that I need to create a complex query based on the state of the tree. I do not want to do this many times as it only needs to be done once. Cheers, -M

8 Replies

AD Administrator Syncfusion Team March 8, 2004 09:20 PM UTC

Hi, I have tested for this issue in our latest release and the AfterCheck event seems to work fine here. It gets fired only once in response to a node being checked (child or parent). Please let me know the version of Essential Suite that you are using. Thanks for your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

MB Matthew Brohn March 9, 2004 11:11 AM UTC

Hmm.. it definitely doesnt work that way here. I am using TreeViewAdv I have a sample I can email you but essential all that is to it is: 1) One Parent node and One Child node 2) Interactive and ShowCheckboxes = true 3) AfterSelect event -When I select the child I get 3 calls to the AferSelect method If you want my project let me know how to get it to you otherwise try the above steps and see if you can repro with them.. Cheers, -M

AD Administrator Syncfusion Team March 9, 2004 12:25 PM UTC

Hi, Thanks for the additional information.I could observe this issue here, and have notified the development team in this regard. I will update you as soon as they get back to me. We appreciate your patience and cooperation. Regards, Guru Patwal Syncfusion, Inc.

JF John Freeborg March 9, 2004 06:54 PM UTC

We are using the beta Actually the more we investigate, the behavior of the AfterCheck events seems to be what I would expect. However, our situation is that we want to do something expensive in terms of cpu time, but only after all the AfterCheck events have been dispatched and the tree has "settled" down. With the tree in interactive mode however, single operations by the user could result in 1 or many AfterCheck events so we don''t really know when the TreeViewAdv control is "done" with them. I guess we could put some lazy timer in, but that seems fragile and non-optimal. We''ve looked at the other events the TreeViewAdv class dispatches, but nothing seems obvious to us and we''ve tried hooking a few and they didn''t do what we want. Sort of a "AfterInteractiveChecks" event is what we seem to be looking for. Ideas? Thanks.

AD Administrator Syncfusion Team March 9, 2004 07:11 PM UTC

Hi, The reason behind the AfterCheck event being fired thrice is explained below : The nodes have the InteractiveCheckBox property set which will adjust the parent''s property when the child''s check state is changed, and the child''s CheckState when the parent''s check state is changed. That accounts for 2 of the 3 events fired. The third event fired is because the root node''s check state is also updated when the top-most node''s check state is changed. However we find this unnecessary and hence have modified the source code accordingly to eliminate the evnt from firing for the third time. We appreciate your feedback, and thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

JF John Freeborg March 9, 2004 08:08 PM UTC

I understand your response. However, it doesn''t seem to address anything in my last post. Is there some event we can listen for that will fire when the tree view is done firing _all_ the AfterCheck events as a result of some user interaction (either by mouse or keyboard)? For us the whole tree represents the parameters that we will use to go off and perform a time consuming operation. After the user changes a check state, we need to know when the tree "settles down" so we can walk the state of the whole tree and then go off and do our expensive operation. At the moment we end up kicking off expensive operations for _every_ AfterCheck and that isn''t what we want. But creating a timer in the AfterCheck handler that when expired says "hmmm...guess that must have been the last AfterCheck event we might be getting because 500 millis went by" or something doesn''t seem like a great solution. Is this clear? Maybe I''m not describing this well enough. Thanks.

AD Administrator Syncfusion Team March 10, 2004 01:25 PM UTC

Hi, Our apologies for having not understood your requirements correctly earlier. We have considered your suggestion for a AfterInteractiveChecks event as a feature request, and this has been internally implemented now. This feature will be available in the next release of Essential Suite. We appreciate your feedback, and thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

JF John Freeborg March 10, 2004 02:14 PM UTC

Thank you very much!

Live Chat Icon For mobile
Up arrow icon