batch Boolean
(default: false)
If set to true
, the data source will batch CRUD operation requests. For example, updating two data items would cause one HTTP request instead of two. By default, the data source
makes an HTTP request for every CRUD operation.
The changed data items are sent as
models
by default. This can be changed via the parameterMap option.
Example - enable the batch mode
<script>
var dataSource = new kendo.data.DataSource({
batch: true,
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/products",
dataType: "jsonp" //"jsonp" is required for cross-domain requests; use "json" for same-domain requests
},
update: {
url: "https://demos.telerik.com/kendo-ui/service/products/update",
dataType: "jsonp" //"jsonp" is required for cross-domain requests; use "json" for same-domain requests
}
},
schema: {
model: { id: "ProductID" }
}
});
dataSource.fetch(function() {
var product = dataSource.at(0);
product.set("UnitPrice", 20);
var anotherProduct = dataSource.at(1);
anotherProduct.set("UnitPrice", 20);
dataSource.sync(); // causes only one request to "https://demos.telerik.com/kendo-ui/service/products/update"
});
</script>