Updating current selection in SingleSelectionModel in response to changes to

32 views
Skip to first unread message

Slava Imeshev

unread,
Dec 11, 2021, 7:35:04 PM12/11/21
to GWT Users
I thought my use case was fairly simple:

1. User selects a row in CellTable.
2. User makes modifications to the selection returned by selectionModel.getSelectedObject()
3. User updates the selected row with dataProvider.getList().set(i, newObjectSameKey)
4. Use case restarts at #2.


Pseudocode:

// Fields 
private final ListDataProvider<T> dataProvider;

private final SingleSelectionModel<T> selectionModel;

// Problem - returns the 'old' cached object after dataProvider.getList().set(i, newObjectSameKey)
return selectionModel.getSelectedObject();


Challenge:

The challenge is that even though the given row remains selected, and is correctly re-rendered after #3, requesting selectionModel.getSelectedObject() returns the previous, before-the-update object.

I did look at the code and does look like SingleSelectionModel responds only to user input.

Is there a way to fix/augment it? Or selection model is just not fit for retrieving the currently selected object that was modified via ListDataProvider?

Thanks!

Slava

Reply all
Reply to author
Forward
0 new messages