autoSyncBoolean
(default: false)
If set to true
, the data source would automatically save any changed data items by calling the sync
method. By default, changes are not automatically saved.
Example - enable auto sync
<script>
var dataSource = new kendo.data.DataSource({
autoSync: 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); // auto-syncs and makes request to https://demos.telerik.com/service/v2/core/products/update
});
</script>
In this article