Edit this page

setDataSource

Sets and binds a dataSource to the widget.

Note: Calling this method with an array will not change the loadOnDemand flag, unlike initialization with an array option.

Parameters

dataSource kendo.data.HierarchicalDataSource

The new dataSource that the widget will bind to

Example

<div id="treeview"></div>
<script>
$("#treeview").kendoTreeView({
  dataSource: [
    { text: "foo", items: [
      { text: "bar" }
    ] }
  ]
});

var treeview = $("#treeview").data("kendoTreeView");

treeview.setDataSource(new kendo.data.HierarchicalDataSource({
  data: [
    { text: "bar", items: [
      { text: "baz" }
    ] }
  ]
}));
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy