This is a migrated thread and some comments may be shown as answers.

Changes in data-model not reflected

2 Answers 86 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
mg1970
Top achievements
Rank 1
mg1970 asked on 05 Feb 2013, 03:39 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 07 Feb 2013, 10:21 AM
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!
0
mg1970
Top achievements
Rank 1
answered on 07 Feb 2013, 02:23 PM
Thank you Alexander,

that worked!
Tags
ListView (Mobile)
Asked by
mg1970
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
mg1970
Top achievements
Rank 1
Share this question
or