Edit this page

Scroll to Selected Item

The following example demonstrates how to scroll the TreeView viewport to the selected node.

    <div id="tree"></div>

      // setup: generate data, select item
      var data = [];
      for (var i = 0; i < 1000; i++) {
        data.push({ text: "Item " + i });
        dataSource: data
      var treeview = $("#tree").data("kendoTreeView");
      treeview.select(treeview.findByText("Item 500"));

      // scroll to selected item
      var itemScrollTop = treeview.select()[0].offsetTop;
      $("html,body").animate({ scrollTop: itemScrollTop });

See Also

For more runnable examples on the Kendo UI TreeView, browse its How To documentation folder.

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article