TreeView.select(node) does not trigger select event

5 posts, 1 answers
  1. Mark
    Mark avatar
    7 posts
    Member since:
    Dec 2011

    Posted 10 Apr 2012 Link to this post

    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.
  2. Answer
    Miguel
    Miguel avatar
    8 posts
    Member since:
    Apr 2012

    Posted 11 Apr 2012 Link to this post

    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







  3. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2894 posts

    Posted 13 Apr 2012 Link to this post

    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!
  4. Mark
    Mark avatar
    7 posts
    Member since:
    Dec 2011

    Posted 13 Apr 2012 Link to this post

    @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?
  5. Miguel
    Miguel avatar
    8 posts
    Member since:
    Apr 2012

    Posted 13 Apr 2012 Link to this post

    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
Back to Top