How can I check if a Kendo Grid has changes? I heard that there is a dirty
property, but I cant find it.
The most convinient way to go is to use datasource.hasChanges()
. However, this requires that the Id
field is defined in the schema.
From the docs:
Checks if the data items have changed. Requires an [ID field] to be configured in schema.model.id, otherwise will always return true.
If you do not have an Id field defined, you can use one of the countless ways to iterate over the data itself.
var isDataSourceDirty = function (ds) {
var dirty = ds._data.filter(function(x){
return x.dirty === true;
});
return dirty.length > 0 || ds._destroyed.length;
};