Select event - Multiple trees

3 posts, 1 answers
  1. Justin Lee
    Justin Lee avatar
    154 posts
    Member since:
    Dec 2009

    Posted 28 Dec 2016 Link to this post

    .asp.net - mvc

    I have a page that has multiple treeviews. (created dynamically)

    I have added a function for the "Select" event of the trees.  In the function, I want to get the Id of the selected node.  From what I've read, this is done by: $("#treename").data("kendoTreeView").dataItem(e.node).id

    However, because the method is wired to multiple trees, I do not know what tree e.node is in. (I do not know what #treename is)

    How can I obtain information about the selected node in the Select event?

     

    Thanks,

    Justin

  2. Answer
    Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    420 posts

    Posted 30 Dec 2016 Link to this post

    Hello Justin,

    As far as I can understand, you have the same Select event handler for multiple TreeViews. In this case, you could access the TreeView, that fires the event from the event argument object:
    function onSelectNode(e) {
        var treeView = e.sender;
    }

    Here you will find a simple implementation of the discussed.

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Justin Lee
    Justin Lee avatar
    154 posts
    Member since:
    Dec 2009

    Posted 30 Dec 2016 in reply to Veselin Tsvetanov Link to this post

    Thanks Veselin.
Back to Top