Can't get the treview instance

3 posts, 0 answers
  1. Luis
    Luis avatar
    3 posts
    Member since:
    Dec 2017

    Posted 24 Jul 2018 Link to this post

    I'm creating a treeview in MVC using the TreeViewBuilder. like this


    I need to get access to the treeview instance in a script. It's not an event, so I can't rely on the tree passing the instance to my function.

    I'm trying, as instructed:

    var myTree = $("#TreeViewTemplateBiding").data('kendoTreeView')

    This does not work, it returns 'undefined'. In fact I can see that $("#TreeViewTemplateBiding") has no data at all.

    Please assist.


  2. Eyup
    Eyup avatar
    4076 posts

    Posted 26 Jul 2018 Link to this post

    Hi Luis,

    I've tried the following configuration to test this behavior and it works as expected on my side:
            .Items(treeview =>
                    .Items(root =>
                        root.Add().Text("Tables & Chairs");
                        root.Add().Text("Occasional Furniture");
                    .Items(root =>
                        root.Add().Text("Bed Linen");
                    .Items(root =>
                        root.Add().Text("Wall Shelving");
                        root.Add().Text("Kids Storage");
                        root.Add().Text("Multimedia Storage");

    Added a button to call the logic:
    <button onclick="buttonClick();">Access TreeView</button>

    And this is the script logic:
        function buttonClick() {
            var treeView = $("#TreeViewTemplateBiding").data().kendoTreeView;

    Please try this configuration and verify that it works properly on your side, too.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Luis
    Luis avatar
    3 posts
    Member since:
    Dec 2017

    Posted 29 Jul 2018 in reply to Eyup Link to this post

    Thanks. This has worked
Back to Top