Edit this page

columns Array

The columns of the TreeList initialized from the columns option. Every item from the columns array has the same fields as the corresponding columns option.

Example - iterate the TreeList columns

<button id="countBtn">Log Column Names</button>
<div id="treelist"></div>
<script>
  $("#treelist").kendoTreeList({
    columns: [
      { field: "lastName" },
      { field: "position" }
    ],
    dataSource: [
      { id: 1, parentId: null, lastName: "Jackson", position: "CEO" },
      { id: 2, parentId: 1, lastName: "Weber", position: "  VP, Engineering" }
    ]
  });
  $("#countBtn").click(function(e){
    var treelist = $("#treelist").data("kendoTreeList");
    for (var i = 0; i < treelist.columns.length; i++) {
      console.log(treelist.columns[i].field); // displays "lastName" and then "position"
    }
  });
</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