New to Kendo UI for jQuery? Start a free 30-day trial

CellIndex

methods

Returns the index of the specified table cell. Skips group and detail table cells.

Parameters:cellString|Element|jQuery

A string, DOM element or jQuery object which represents the table cell. A string is treated as a jQuery selector. If there are locked columns in the Grid, the jQuery object, representing the cell, must be passed as an argument.

Returns:Number

the index of the specified table cell.

<div id="grid"></div>
<script>
let encode = kendo.htmlEncode;
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 },
  ],
  detailTemplate: ({ name, age }) => `<div>Name: ${encode(name)}</div><div>Age: ${encode(age)}</div>`
});
var grid = $("#grid").data("kendoGrid");
var cell = $("#grid td:eq(1)");
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(grid.cellIndex(cell));
</script>
<div id="grid"></div>
<script>
let encode = kendo.htmlEncode;
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 },
  ],
  detailTemplate: ({ name, age }) => `<div>Name: ${encode(name)}</div><div>Age: ${encode(age)}</div>`
});
var grid = $("#grid").data("kendoGrid");
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(grid.cellIndex("td:eq(1)"));
</script>
Not finding the help you need?
Contact Support