View Full Version : RPC scoping problem -cannot get selected items

30 Jul 2009, 11:04 PM
Hi. I posted a message on Monday about this RPC problem but got no responses. I tried a workaround - collecting the selections as the selection event fires - but because of scoping (?) I cannot retain the selected items. I would like to be able to create a final grid, but cannot. I can create a final checkBoxSelectionModel but it doesn't help (I suspect for the same reason I can't use a final ArrayList.) Any ideas?

I want to store selected grid items (column data)

private final ArrayList<String> selectedSnps = new ArrayList<String>();

Called when checkboxes are selected.
Works as expected.

sm.addSelectionChangedListener(new SelectionChangedListener<GridDataModel>(){
public void selectionChanged(
SelectionChangedEvent<GridDataModel> se) {
List<GridDataModel> items = se.getSelection();
for(GridDataModel i : items){
System.out.println("Number snps = " + selectedSnps.size());

Called after grid items have been selected and user presses a button.
The ArrayList size is always 0!!!

public ArrayList<String> getSelectedSnps() {
System.out.println("Number snps = " + selectedSnps.size());