When calling set() on a kendo Model object, the 'dirty' field appears to be set to true even if the set is cancelled from the "set" event. See http://dojo.telerik.com/UMOVU for an example of this behavior.
After a little research, I found that the kendo.data.Model.set() function is setting dirty = true before calling ObservableObject.set():
set:
function
(field, value, initiator) {
var
that =
this
;
if
(that.editable(field)) {
value = that._parse(field, value);
if
(!equal(value, that.get(field))) {
that.dirty =
true
;
ObservableObject.fn.set.call(that, field, value, initiator);
}
}
},
The problem could be fixed by doing something like this instead:
set:
function
(field, value, initiator) {
var
that =
this
;
if
(that.editable(field)) {
value = that._parse(field, value);
if
(!equal(value, that.get(field))) {
// ObservableObject.set() should return a value indicating whether or not the default was prevented.
if
(!ObservableObject.fn.set.call(that, field, value, initiator))
that.dirty =
true
;
// Only set dirty = true if the value was actually modified.
}
}
},