SelectionModel currently handles mouse click and keyboard on select row in cellTable. How do I do it programmatically to move to next/prev row according to current selected row?
Asked
Active
Viewed 717 times
2 Answers
1
- In your list of items find the currently selected item
- Determine next item that would be selected
- Call the
SelectionModel.setSelected(T object, boolean selected)
method, passing your next object to be selected andtrue
for theselected
parameter.
To find the currently selected object (if you don't hold a reference to it anywhere) you can iterate over all the objects in the CellTable and check which one is selected by calling SelectionModel.isSelected(T object)
method.

Strelok
- 50,229
- 9
- 102
- 115
-1
If you don't want to use the selection model directly, you can just use the JTable method:
setRowSelectionInterval

Ashwinee K Jha
- 9,187
- 2
- 25
- 19
-
1This question is about GWT which is Google Web Toolkit. JTable is part of Swing. – Strelok Nov 29 '11 at 22:36