Edit this page

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);
  console.log(index); // displays "0"
});
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy