This is a migrated thread and some comments may be shown as answers.

TreeView.select(node) does not trigger select event

4 Answers 1329 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 10 Apr 2012, 03:09 PM
When I programmatically select a node using the select(node) method, the select event handler (applied when the TreeView was created) does not get called.

4 Answers, 1 is accepted

Sort by
0
Accepted
Miguel
Top achievements
Rank 1
answered on 11 Apr 2012, 03:24 PM
I am not sure if Telerik will consider this a bug... I do...  But if you want to work around it, first do the select so that the kendo tree can update its internals and then call trigger so that the callback get invoked.

Please refer to the jsfiddle that illustrates the workaround.
http://jsfiddle.net/manchagnu/CDAVZ/ 

Play around with commenting out the select call and the trigger call to see what they do to kendoui treeview.


-Miguel







0
Alexander Valchev
Telerik team
answered on 13 Apr 2012, 09:28 AM
Hello guys,

Actually that is the behaviour expected by design.
The client API is not supposed to trigger the events, but I see that Miguel already provided an example that illustrates a workaround for this.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mark
Top achievements
Rank 1
answered on 13 Apr 2012, 10:47 AM
@Miguel Thanks, that workaround worked perfectly. Might do some monkey-patching, create a selectWithEvent method.

@Alexander Maybe there could be an argument to select to tell it whether to trigger the event or not?
0
Miguel
Top achievements
Rank 1
answered on 13 Apr 2012, 12:38 PM
I think keeping the event and the select call as two separate things is completely fine.

The reason I expressed this to be a bug is because there is no documentation on having to make both calls, and whatever exists suggests that only calling 'select' is sufficient.  Maybe a revision to the doc could save lives. :-)

Glad it worked guys!

Miguel
Tags
TreeView
Asked by
Mark
Top achievements
Rank 1
Answers by
Miguel
Top achievements
Rank 1
Alexander Valchev
Telerik team
Mark
Top achievements
Rank 1
Share this question
or