multi selection without using Ctrl

29 views
Skip to first unread message

mma

unread,
Dec 29, 2011, 5:24:54 AM12/29/11
to google-we...@googlegroups.com
Hi there.

I want to implement the following changes regarding the behavior of the MultiSelectionModel:
  • Each click on a row should select that row and maintain all the previous selected rows
  • Each click on a selected row should unselect it
This sounds very easy but I haven't managed to implement it.

Any ideas? Thanks!

mma

unread,
Jan 2, 2012, 12:51:11 PM1/2/12
to google-we...@googlegroups.com
I'm replying to my own post with the solution.


class ServiceTypeTableView {

public ServiceTypeList () {}
 

DefaultSelectionEventManager<ServiceType> customManager = DefaultSelectionEventManager.createCustomManager(new EventTranslator<ServiceType>() {

public boolean clearCurrentSelection(CellPreviewEvent<ServiceType> event) { 

return false;

}


public SelectAction translateSelectionEvent(CellPreviewEvent<ServiceType> event) {

return SelectAction.TOGGLE;

}

});

MultiSelectionModel<ServiceType> multiSelectionModel = new MultiSelectionModel<ServiceType>();

CellTable<ServiceType>() cellTable = new CellTable<ServiceType>();

cellTable.setSelectionModel(multiSelectionModel, customManager);

...

}


...

}

Reply all
Reply to author
Forward
0 new messages