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

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

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -