Expand with one click

2 posts, 0 answers
  1. Paulo
    Paulo avatar
    3 posts
    Member since:
    Sep 2011

    Posted 24 Sep 2011 Link to this post

    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
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2527 posts

    Posted 26 Sep 2011 Link to this post

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