hasChanges Boolean
Checks if the data items have changed.
Requires an [
ID
field] to be configured in schema.model.id. Otherwise, will always returntrue
.
Returns
Boolean
—Returns true
if the data items have changed. Otherwise, returns false
.
Example - check if the data source is changed
<script>
var dataSource = new kendo.data.DataSource({
data: [
{ id: 1, name: "Jane Doe" }
],
schema: {
model: { id: "id" }
}
});
dataSource.fetch(function() {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.hasChanges()); // displays "false"
dataSource.add({ name: "John Doe" });
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.hasChanges()); // displays "true"
});
</script>