batchBoolean(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
modelsby default. This can be changed via theparameterMapoption.
Example - enable the batch mode
<script>
var dataSource = new kendo.data.DataSource({
batch: true,
transport: {
read: {
url: "https://demos.telerik.com/service/v2/core/products"
},
update: {
url: "https://demos.telerik.com/service/v2/core/products/update",
type: "POST",
contentType: "application/json",
}
},
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/service/v2/core/products/update"
});
</script>
In this article