columns Array

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

Example - iterating 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++) {
/* The result can be observed in the DevTools(F12) console of the browser. */
      console.log(treelist.columns[i].field); // displays "lastName" and then "position"
    }
  });
</script>
In this article