How to check Kendo Observable has changed

1k Views Asked by At

Hi I have a form that contains Certain fields and I have made it as Kendo Observable as follows

var TITLE = $("#TITLE").val().trim();
var DESC = $("#DESC").val().trim(); 

 Analysis.Kendo_VM = kendo.observable({
     TITLE: TITLE != null ? TITLE : "",
     DESC: DESC != null ? DESC : "",
 });

I want to Check if there is any changes made to this Observable. For that we use hasChanges() or dirty() function But that's not supporting in my case.

var isdatasrc_changed = Analysis.Kendo_VM.hasChanges()

OR

var isdatasrc_changed = Analysis.Kendo_VM.dirty()

it should return true if changes has been made to the Observable.But Getting error that hasChanges() and dirty() is Undefined.

1

There are 1 best solutions below

0
On

dirty is a field of the Kendo UI Model object, while hasChanges is a method of the Kendo UI DataSource object. Neither of these are available for the Kendo UI ObservableObject.

You can use the change event to track changes in observable objects.