autoSync Boolean
(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/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); // auto-syncs and makes request to https://demos.telerik.com/kendo-ui/service/products/update
});
</script>