SingleSelectionModel with KeyProvider does not update selected object when data is refreshed

59 views
Skip to first unread message

stuckagain

unread,
Dec 6, 2013, 9:35:46 AM12/6/13
to google-we...@googlegroups.com
Hi,

I noticed an issue in the SingleSelectionModel when used in combination with a KeyProvider and updating the cell table with new data.

The idea is that I want to retain selection, and that seems to work. What does not work is when I use the getSelectedObject method I get an older version of the object instead of the refreshed version.
Is that the way it is supposed to work ? Wouldn't it be smarter to recalculate selection when the data in the table is updated ?

I currently implemented a workaround that uses the KeyProvider to find the item in the table that has the same key as the previous selection.

David

Ümit Seren

unread,
Dec 7, 2013, 9:01:58 AM12/7/13
to google-we...@googlegroups.com
How does your KeyProvider look like ? Do you check on object equality or do you check equality of an id/key of your objects ? 

David

unread,
Dec 9, 2013, 7:30:24 AM12/9/13
to google-we...@googlegroups.com
It checks for equality on a key of the objects.
 
David


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Ümit Seren

unread,
Dec 9, 2013, 8:05:19 AM12/9/13
to google-we...@googlegroups.com

Did you pass the KeyProvider to both the SelectionModel as well as the CellTable ?



--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/HbDKhXPDwp0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.

Gordan Krešić

unread,
Dec 17, 2013, 2:13:58 PM12/17/13
to google-we...@googlegroups.com
I just hit the same issue.

Tripple checked that DataGrid, ListDataProvider and SingleSelectionModel all use the same KeyProvider (that itself uses stableId() from contained EntityProxies).

Updates are pushed via ListDataProvider.getList().set(int, T) and they are shown in table with selection preserved.

Still, SingleSelectionModel.getSelectedObject() (called in separate (later) event, just to eliminate missed flush()-es from ListDataProvider) returns old object as it were before update.


On Friday, December 6, 2013 3:35:46 PM UTC+1, stuckagain wrote:

David

unread,
Dec 17, 2013, 2:16:24 PM12/17/13
to google-we...@googlegroups.com
Hi Gordan,

Ah great, then I was not alone having this issue. Problem was that we are using a highly customized layer on top of the DataGrid so I was not entire sure that it was caused by my team additions or not.

David


--
Reply all
Reply to author
Forward
0 new messages