dataItem
Returns the data item to which the specified table row is bound. The data item is a Kendo UI Model instance.
When using the Grid's MVC wrapper, the Grid must be Ajax-bound for the dataItem() method to work. When using server binding, the dataSource instance does not contain the serialized data items.
Parameters
row String|Element|jQuery
A string, DOM element or jQuery object which represents the table row. A string is treated as a jQuery selector.
Returns
kendo.data.ObservableObject
the data item to which the specified table row is bound. More information about the ObservableObject type...
Example - get the data item to which the first table row is bound
<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");
var dataItem = grid.dataItem("tbody tr:eq(0)");
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataItem.name); // displays "Jane Doe"
</script>