Forcing MVVM View to update after view-model changes

2 posts, 0 answers
  1. Jairo
    Jairo avatar
    6 posts
    Member since:
    Mar 2017

    Posted 23 Jun 2017 Link to this post


    So I read some of the Kendo documentation regarding MVVM and it says that once the view model is updated the view (HTML) should update as well. 

    I tried that many times and when I change the viewModel from javascript I don't see the changes updated in the HTML unless I trigger the change event, as shown here:

    You will notice that if you comment out this line: viewModel.trigger("change", { field: "price"}); then the changes won't be propagated to the HTML view.

    Is there any way it can be done automatically without triggering the "change" event?


  2. Dimitar
    Dimitar avatar
    815 posts

    Posted 27 Jun 2017 Link to this post

    Hello Jairo,

    On the following Dojo example you will find a modified version of your code. You will notice that I have changed the direct assignment of the ViewModel property to use the ObservableObject's set method which has an internal change tracking mechanism. 

    In addition to the above, I have added a button with a click event binding, which also changes the value by using the set() method. 

    I hope this helps. In case you have any other questions, please do not hesitate to contact us.

    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top