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

Refresh/Update list-item template?

1 Answer 281 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
myTeamWorks
Top achievements
Rank 1
myTeamWorks asked on 23 Jan 2013, 11:40 AM
Hi,

I have the following scenario:
  • A listview
  • A modalview to edit listview item
Once the listview-item is edited, I would like to close the modalview and update/refresh ONLY the listview-item that was impacted.

Is this possible? If yes, how can I achieve this? I want to avoid to refresh all the listview because the scroll position would be lost :-S.

Thanks for your support.
myTeamWorks

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 25 Jan 2013, 09:52 AM
Hello,

It is a bit unclear how do you perform the editing. Could you please provide code snippets demonstrating your current implementation.

Generally speaking you should obtain reference to the respective ListView Model and the use its set method. The Model is a collection of key-value pairs and can be retrieved in two ways.

One is through the event argument of the ListView's click event:

Another way is to use the Grid dataSource API and the getByUid method, which accepts the data-uid HTML attribute of the ListView's <li> as an argument:
Once you have the Model, use its set method to modify the data.

This will cause DataSource to throw its change event which will force the ListView to refresh automatically. The scroller position should not change.

Another approach is to use MVVM and edit via value bound inputs. The approach is demonstrated in this code library project.

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!
Tags
ListView (Mobile)
Asked by
myTeamWorks
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or