javascript - Kendo Observable Change event -


i have kendo obervable follows:

var viewmodel = kendo.observable({      id: 1,      title: "somevalue", }); 

and have bound follows:

kendo.bind($(".bind-view"), viewmodel ); 

now there button on page. when clicked need check if there changes viewmodel.

i have tried

    $(".clearanalysisinfo").on('click', function (event) {           viewmodel.bind("change", function (e) {          //some code       });   }); 

but i'm not able viewmodel property whether changed or not.

binding observableobject's change event of inside button's click handler late. need after observableobject created.

inside change handler, receive information changed field. use information raise javascript flag or save details need, can use them later in button's click handler.

var viewmodelchanged = false;  var viewmodel = kendo.observable({     id: 1,     title: "somevalue", });  viewmodel.bind("change", function (e) {     viewmodelchanged = true; });  $(".clearanalysisinfo").on('click', function (event) {      if (viewmodelchanged) {         // ...     } }); 

Comments

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -