// calculates total sum of unitPrice field's values.
[{ field: "unitPrice", aggregate: "sum" }]data: Array// 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
});// 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" } ]// groups data by orderId field
group: { field: "orderId" }
// groups data by orderId and customerName fields
group: [ { field: "orderId", dir: "desc" }, { field: "customerName", dir: "asc" } ]var dataSource = new kendo.data.DataSource({
page: 2 // displays the second page of data in the bound widget
});var dataSource = new kendo.data.DataSource({
pageSize: 5 // 5 records per page of data
});schema: Objectvar 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: Functiondata: Functiongroups: Functionmodel: Objectvar 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: Objectid: Number | Stringparse: Functiontotal: Functiontype: Stringvar 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
});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:
It is possible to modify these parameters by using the parameterMap function found on the transport object (see transport in Configuration).
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
});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).
var dataSource = new kendo.data.DataSource({
transport: {
read: "orders.json"
},
serverGrouping: true,
sort: { field: "orderId", dir: "asc" } // group by orderId descending
});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:
It is possible to modify these parameters by using the parameterMap function found on the transport object (see transport in Configuration).
var dataSource = new kendo.data.DataSource({
transport: {
read: "orders.json"
},
serverPaging: true,
pageSize: 5 // 5 records per page
});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).
var dataSource = new kendo.data.DataSource({
transport: {
read: "orders.json"
},
serverSorting: true,
sort: { field: "orderId", dir: "asc" }
});// 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: Objectcreate: Object | Stringvar dataSource = new kendo.data.DataSource({
transport: {
read: "orders.json",
update: {
url: "orders/update.json",
data: {
orderId: $("#input").val() // sends the value of the input as the orderId
}
}
}
});dataType: Stringurl: Object | Stringdestroy: Object | StringdataType: Stringurl: Object | StringparameterMap: Functionvar 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// 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 | FunctiondataType: Stringurl: Stringupdate: Object | Stringvar dataSource = new kendo.data.DataSource({
transport: {
read: "orders.json",
destroy: {
url: "orders/create.json",
}
}
});dataType: Stringurl: Object | String