Edit this page

dataTextField String |Array (default: null)

Sets the field of the data item that provides the text content of the nodes. If an array, each level uses the field that is at the same index in the array, or the last item in the array.

Example

<div id="treeview"></div>
<script>
var items = [
  { ProductName: "Tea", items: [
    { ProductName: "Green Tea" },
    { ProductName: "Black Tea" }
  ] },
  { ProductName: "Coffee" }
];
$("#treeview").kendoTreeView({
  dataTextField: "ProductName",
  dataSource: items
});
</script>

Example - using different fields on different levels

<div id="treeview"></div>
<script>
var items = [
  { CategoryName: "Tea", items: [
    { ProductName: "Green Tea" },
    { ProductName: "Black Tea" }
  ] },
  { CategoryName: "Coffee" }
];
$("#treeview").kendoTreeView({
  dataTextField: [ "CategoryName", "ProductName" ],
  dataSource: items
});
</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