indexOf

Gets the index of the specified data item.

Parameters

dataItem kendo.data.ObservableObject

The target data item.

Returns

Number—The index of the specified data item. Returns -1 if the data item is not found.

Example - get the index of a data item

<script>
var dataSource= new kendo.data.DataSource({
  data: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 }
  ]
});
dataSource.fetch(function() {
  var dataItem = dataSource.at(0);
  var index = dataSource.indexOf(dataItem);
/* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(index); // displays "0"
});
</script>
In this article