columns Array
The columns of the grid initialized from the columns option. every item from the columns
array has the same fields as the corresponding columns option.
Example - iterate the grid columns
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" }
],
dataSource: [
{ name: "Jane Doe", age: 30 },
{ name: "John Doe", age: 33 }
]
});
var grid = $("#grid").data("kendoGrid");
for (var i = 0; i < grid.columns.length; i++) {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(grid.columns[i].field); // displays "name" and then "age"
}
</script>