Refresh/Update list-item template?

2 posts, 0 answers
  1. myTeamWorks
    myTeamWorks avatar
    15 posts
    Member since:
    Jan 2013

    Posted 23 Jan 2013 Link to this post


    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.
  2. Alexander Valchev
    Alexander Valchev avatar
    2887 posts

    Posted 25 Jan 2013 Link to this post


    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.

    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!
Back to Top