Gets the total number of data items. Uses if the option is set.


Number—The total number of data items. Returns the length of the array returned by the data method if or 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

var dataSource = new{
  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(; // displays "2"
In this article
Not finding the help you need? Improve this article