I have created a basic CellTable and filled it with some data. Now I want to add a clickHandler to each row but I\'m not sure how to do this. I\'ve created a clickEvent for
Another way to have a cell selected can be made using a NoSelectionModel and add it to the table:
//EDIT: this is a field, not a local variable
TheCellObject clickedObject; //the object selected by selectionModel
final NoSelectionModel selectionModel = new NoSelectionModel();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
clickedObject = selectionModel.getLastSelectedObject();
}
});
cellTable.setSelectionModel(selectionModel); //add selection model to your celltable