aggregate: Array | Object(default: undefined)
Sets fields on which initial aggregates should be calculated

Example

// calculates total sum of unitPrice field's values.
[{ field: "unitPrice", aggregate: "sum" }]
data: Array
Specifies the local JavaScript object to use for the data source.

Example

// bind the datasource to a local JavaScript array
var orders = [ { orderId: 10248, customerName: "Paul Smith" }, { orderId: 10249, customerName: "Jane Jones" }];
var dataSource = new kendo.data.DataSource({
     data: orders
});
filter: Array | Object(default: undefined)
Sets initial filter

Example

// returns only data where orderId is equal to 10248
filter: { field: "orderId", operator: "eq", value: 10248 }

// returns only data where orderId is equal to 10248 and customerName starts with Paul
filter: [ { field: "orderId", operator: "eq", value: 10248 },
          { field: "customerName", operator: "startswith", value: "Paul" } ]
group: Array | Object(default: undefined)
Sets initial grouping

Example

// groups data by orderId field
group: { field: "orderId" }

// groups data by orderId and customerName fields
group: [ { field: "orderId", dir: "desc" }, { field: "customerName", dir: "asc" } ]
page: Number(default: undefined)
Sets the index of the displayed page of data.

Example

var dataSource = new kendo.data.DataSource({
    page: 2 // displays the second page of data in the bound widget
});
pageSize: Number(default: undefined)
Sets the number of records which contains a given page of data.

Example

var dataSource = new kendo.data.DataSource({
    pageSize: 5 // 5 records per page of data
});
schema: Object
Set the object responsible for describing the raw data format

Example

var dataSource = new kendo.data.DataSource({
     transport: {
       read: "Catalog/Titles",
     },
     schema: {
         aggregates: function(data) {
              // returns aggregates
         },
         data: function(data) {
             return data.result;
         },
         total: function(data) {
             return data.totalCount;
         },
         parse: function(data) {
             return data;
         },
         type: "jsonp"
     }
 });
aggregates: Function
Returns the calculated aggregates as object. Result should have the following format:

Example

{
  FIEL1DNAME: {
      FUNCTON1NAME: FUNCTION1VALUE,
      FUNCTON2NAME: FUNCTION2VALUE
  },
  FIELD2NAME: {
      FUNCTON1NAME: FUNCTION1VALUE
  }
}

Example

{
  unitPrice: {
      max: 100,
      min: 1
  },
  productName: {
      count: 42
  }
}
data: Function
Returns the deserialized data as array.
groups: Function
Used instead of data function if remote grouping operation is executed. Returns the deserialized data as array. Result should have the following format:

Example

[{
  aggregates: {
      FIEL1DNAME: {
          FUNCTON1NAME: FUNCTION1VALUE,
          FUNCTON2NAME: FUNCTION2VALUE
      },
      FIELD2NAME: {
          FUNCTON1NAME: FUNCTION1VALUE
      }
  },
  field: FIELDNAME, // the field name on which is grouped
  hasSubgroups: true, // false if there are not sub group items and this is the top most group
  items: [
  // either the inner group items (if hasSubgroups is true) or the data records
     {
         aggregates: {
             //nested group aggregates
         },
         field: NESTEDGROUPFIELDNAME,
         hasSubgroups: false,
         items: [
         // data records
         ],
         value: NESTEDGROUPVALUE
     },
     //nestedgroup2, nestedgroup3, etc.
  ],
  value: VALUE // value of the field on which is grouped
}
// group2, group3, etc.
]
model: Object
Describes the Model

Example

var dataSource = new kendo.data.DataSource({
       //..
        schema: {
            model: {
                id: "ProductID",
                fields: {
                     ProductID: {
                        //this field will not be editable (default value is true)
                        editable: false,
                        // a defaultValue will not be assigned (default value is false)
                        nullable: true
                     },
                     ProductName: {
                         validation: { //set validation rules
                             required: true
                         }
                     },
                     UnitPrice: {
                       //data type of the field {Number|String|Boolean|Date} default is String
                       type: "number",
                       // used when new model is created
                       defaultValue: 42,
                       validation: {
                           required: true,
                           min: 1
                       }
                   }
               }
           }
       }
   })
fields: Object
Describes the model fields and their properties

Available field attrbiutes:

editable
Determines if this field will be editable (default value is true)
defaultValue
The value which will be used to populate the field when new non-existing model is created. Default value is type attrbiute specific i.e. string fields will have empty string as defaultValue
nullable
Determines if the value set through defaultValue will be used (default value is false)
type
The type of the field {Number|String|Boolean|Date}. Default type is string.
validation
A set of validation rules. The built-in KendoUI Validator rules are available as well as custom rules.

Example

var dataSource = new kendo.data.DataSource({
       //..
        schema: {
            model: {
                fields: {
                     UnitPrice: {
                       validation: {
                           required: true,
                           min: 1,
                           date: { message: "My custom message" }, // custom message
                           aCustomRule: function(input) { // custom validation rule
                              return input.val() === "foo"
                           }
                       }
                   }
               }
           }
       }
   })
id: Number | String
The field use to identify an unique Model instance
parse: Function
Executed before deserialized data is read. Appropriate for preprocessing of the raw data.
total: Function
Returns the total number of records.
type: String
Specify the type of schema { xml | json }
serverAggregates: Boolean(default: false)
Determines if aggregates should be calculated on the server.

Example

var dataSource = new kendo.data.DataSource({
    transport: {
        read: "orders.json"
    },
    serverAggregates: true,
    aggregate: { field: "orderId", operator: "eq", value: 10248 } // return only data where orderId equals 10248
});
serverFiltering: Boolean(default: false)
Determines if filtering of the data should be handled on the server.

The serverFiltering must be used in conjunction with the filter configuration. By default, a filter object is sent to the server with the query string in the following form:

Possible values for operator include:

Equal To
"eq", "==", "isequalto", "equals", "equalto", "equal"
Not Equal To
"neq", "!=", "isnotequalto", "notequals", "notequalto", "notequal", "ne"
Less Then
"lt", "<", "islessthan", "lessthan", "less"
Less Then or Equal To
"lte", "<=", "islessthanorequalto", "lessthanequal", "le"
Greater Then
"gt", ">", "isgreaterthan", "greaterthan", "greater"
Greater Then or Equal To
"gte", ">=", "isgreaterthanorequalto", "greaterthanequal", "ge"
Starts With
"startswith"
Ends With
"endswith"
Contains
"contains"

It is possible to modify these parameters by using the parameterMap function found on the transport object (see transport in Configuration).

Example

var dataSource = new kendo.data.DataSource({
    transport: {
        read: "orders.json"
    },
    serverFiltering: true,
    filter: { field: "orderId", operator: "eq", value: 10248 } // return only data where orderId equals 10248
});
serverGrouping: Boolean(default: false)
Determines if grouping of the data should be handled on the server.

The serverGrouping must be used in conjunction with the group configuration. By default, a group object is sent to the server with the query string in the following form:

It is possible to modify these parameters by using the parameterMap function found on the transport object (see transport in Configuration).

Example

var dataSource = new kendo.data.DataSource({
    transport: {
        read: "orders.json"
    },
    serverGrouping: true,
    sort: { field: "orderId", dir: "asc" } // group by orderId descending
});
serverPaging: Boolean(default: false)
Determines if paging of the data should be handled on the server.

serverPaging must be used in conjunction with the pageSize configuration setting. The following options to the server as part of the query string by default:

take
contains the number of records to retreive
skip
how many records from the front of the dataset to begin reading
page
the index of the current page of data
pageSize
the number of records per page

It is possible to modify these parameters by using the parameterMap function found on the transport object (see transport in Configuration).

Example

var dataSource = new kendo.data.DataSource({
    transport: {
        read: "orders.json"
    },
    serverPaging: true,
    pageSize: 5 // 5 records per page
});
serverSorting: Boolean(default: false)
Determines if sorting of the data should be handled on the server.

The serverSorting must be used in conjunction with the sort configuration. By default, a sort object is sent to the server with the query string in the following form:

It is possible to modify these parameters by using the parameterMap function found on the transport object (see transport in Configuration).

Example

var dataSource = new kendo.data.DataSource({
    transport: {
        read: "orders.json"
    },
    serverSorting: true,
    sort: { field: "orderId", dir: "asc" }
});
sort: Array | Object(default: undefined)
Sets initial sort order

Example

// sorts data ascending by orderId field
sort: { field: "orderId", dir: "asc" }

// sorts data ascending by orderId field and then descending by shipmentDate
sort: [ { field: "orderId", dir: "asc" }, { field: "shipmentDate", dir: "desc" } ]
transport: Object
Sets the object responsible for loading and saving of data. This can be a remote or local/in-memory data.
create: Object | String
Options for remote create data operation, or the URL of the remote service

Example

var dataSource = new kendo.data.DataSource({
    transport: {
        read: "orders.json",
        create: {
            url: "orders/create.json",
            data: {
                orderId: $("#input").val() // sends the value of the input as the orderId
            }
        }
    }
});
dataType: String
The type of data that you're expecting back from the server
url: Object | String
The remote url to call when creating a new record
destroy: Object | String
Options for the remote delete data operation, or the URL of the remote service
dataType: String
The type of data that you're expecting back from the server
url: Object | String
The remote url to call when creating a new record
parameterMap: Function
Convert the request parameters from dataSource format to remote service specific format.

Example

var dataSource = new kendo.data.DataSource({
     transport: {
       read: "Catalog/Titles",
       parameterMap: function(options) {
          return {
             pageIndex: options.page,
             size: options.pageSize,
             orderBy: convertSort(options.sort)
          }
       }
     }
 });
read: Object | String
Options for remote read data operation, or the URL of the remote service

Example

// settings various options for remote data transport
var dataSource = new kendo.data.DataSource({
    transport: {
        read: {
            // the remote service URL
            url: "http://search.twitter.com/search.json",

            // JSONP is required for cross-domain AJAX
            dataType: "jsonp",

            // additional parameters sent to the remote service
            data: {
                q: function() {
                    return $("#searchFor").val();
                }
            }
        }
    }
});

 // consuming odata feed without setting additional options
 var dataSource = new kendo.data.DataSource({
     type: "odata",
     transport: {
         read: "http://odata.netflix.com/Catalog/Titles"
     }
 });
data: Object | Function
Additional data to be sent to the server
dataType: String
The type of data that you're expecting back from the server
url: String
The remote service URL
update: Object | String
Options for remote update operation, or the URL of the remote service

Example

var dataSource = new kendo.data.DataSource({
    transport: {
        read: "orders.json",
        update: {
            url: "orders/update.json",
        }
    }
});
dataType: String
The type of data that you're expecting back from the server
url: Object | String
The remote url to call when updating a record
type: String
Loads transport with preconfigured settings. Currently supports only "odata" (Requires kendo.data.odata.js to be included).