Changes in data-model not reflected

3 posts, 1 answers
  1. mg1970
    mg1970 avatar
    5 posts
    Member since:
    Dec 2012

    Posted 05 Feb 2013 Link to this post

    One of my listviews uses a template to populate the content rows:

    <
    ul data-template="tmpl_jailcard_comments" data-bind="source:jcComments" data-role="listview"> </ul>

    When the user displays the same screen for a second time (Click 'Back' and click 'View jail cards' again) changes in the data-model are not reflected. The template works with the original data that it was bound to and ignores any change to the data-model

    The following jsfiddle illustrates this: 

    http://jsfiddle.net/elgato/EhxUb/13/

    Any ideas how to make the listview template reflect an updated data-model?


  2. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 07 Feb 2013 Link to this post

    Hello,

    In order to notify the ViewModel and all the bound widgets for the change, you must use the set method.
    commentData["jcComments"] = jcComments;
    //should be changed to
    commentData.set("jcComments", jcComments);

    Also please make the commentData variable an observable object.
    commentData = kendo.observable({});

    Here is a link to the updated fiddle: http://jsfiddle.net/valchev/EhxUb/20/
    I hope this will help.

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. mg1970
    mg1970 avatar
    5 posts
    Member since:
    Dec 2012

    Posted 07 Feb 2013 Link to this post

    Thank you Alexander,

    that worked!
Back to Top