at
Returns the data item at the specified index. The index is zero-based.
Parameters
index Number
The zero-based index of the data item.
Returns
kendo.data.ObservableObject
—The data item at the specified index. Returns undefined
if a data item is not found at the specified index.
Returns a kendo.data.Model
instance if the schema.model option is set.
Example - get a data item
<script>
var dataSource = new kendo.data.DataSource({
data: [
{ name: "Jane Doe" },
{ name: "John Doe" }
]
});
dataSource.fetch(function(){
var dataItem = dataSource.at(0);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataItem.name); // displays "Jane Doe"
var dataItemWhichDoesNotExist = dataSource.at(3);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataItemWhichDoesNotExist); // displays "undefined"
});
</script>