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>
In this article
Not finding the help you need? Improve this article