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

Expand with one click

1 Answer 158 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Paulo
Top achievements
Rank 1
Paulo asked on 24 Sep 2011, 10:48 PM
Hi,
I'm trying to expand a TreeView node with a single mouse click.
To do this, I thought about using the select event (single click) to call the expand method.
Something like:

<script>
    $(document).ready(function() {
        $("treeview").kendoTreeView({
            select: function(nodevariable) {
                EXPAND METHOD SHOULD GO HERE
            }
        });
    });
</script>


Did anyone ever had the same situation or know if there's an example of an expand method I could use? Or how to use it in this situation? I tried the the code samples on the demo page but I couldn't understand how to get the Selector out of a node type.

thank you very much,
Paulo

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 26 Sep 2011, 01:39 PM
Hi Paulo,

The line of code you are looking for is
this.expand(e.node);


You can also attach it dynamically (rather than upon the treeview initialization) like so:

$(".k-treeview").data("kendoTreeView")
    .bind("select", function(e) {
        this.expand(e.node);
    });

Regards,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
Paulo
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or