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

Selectable ListView binded to a DataSource looses selection on data change

4 Answers 131 Views
ListView
This is a migrated thread and some comments may be shown as answers.
rlapao
Top achievements
Rank 1
rlapao asked on 27 Apr 2012, 06:46 PM
Hi,

I'm I have created an example that illustrates my problem: http://jsfiddle.net/tcTRy/11/

I believe that this is the expected behavior, but is there a workaround to don't loose selection?

In my case I have a listview that when is selected show some details, and some of the details causes the list view datasource data to change. For instace if I edit the Title this will update the Title in the listview, although it would be nice to don't loose the selection, or else the details will be hidden.

Any ideas?

Thanks,
Ricardo

4 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 10 Aug 2012, 12:47 PM
+1 same issue here.

I have a datasource for my listview. The objects of the datasource having a property called "data". The data property isnt shown in the listview so it wouldnt be necessary to refresh the list everytime the data property changed. Is there a way to prevent the list from refreshing (and deselecting)? In my case the data proeprty is an array and I add items to this array almost the whole time.
0
Kevin
Top achievements
Rank 1
answered on 14 Aug 2012, 06:24 PM
Seems like the problem is solved with the latest release.
0
Eric
Top achievements
Rank 1
answered on 19 Aug 2013, 08:59 PM
As of version 2013.2.716 this still appears to be the behavior. If you have the selected item bound and make changes to it while selected, the item deselects from the list. Is this the intended behavior or a bug?

-Eric
0
Kiril Nikolov
Telerik team
answered on 22 Aug 2013, 01:32 PM
Hello Guys,

When an item is changed in the Kendo UI ListView, only the current item is redrawn and not the whole ListView. So saving the selected element (or its uid), will make it possible to select the element that was selected prior the change. Then you can use the itemChanged event (fired after the element is updated) to select the same element by the uid(which remains the same).

I have prepared a short example showing a possible implementation:

http://jsbin.com/OTEmOle/1/edit
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView
Asked by
rlapao
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Eric
Top achievements
Rank 1
Kiril Nikolov
Telerik team
Share this question
or