total
Gets the total number of data items. Uses schema.total if the transport.read option is set.
Returns
Number
—The total number of data items. Returns the length
of the array returned by the data method if schema.total
or transport.read
are not set.
Returns 0
if the data source was not populated with data items via the read, fetch, or query methods.
Example - get the total number of data items
<script>
var dataSource = new kendo.data.DataSource({
data: [
{ name: "Jane Doe", age: 30 },
{ name: "John Doe", age: 33 }
]
});
dataSource.fetch(function() {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.total()); // displays "2"
});
</script>