I used NatTable to create table.
But I don't know how to config it to apply to select entire row not single.
Use the RowSelectionModel
. The following snippet is extracted from the _5052_RowSelectionExample
of the NatTable Examples.
// use a RowSelectionModel that will perform row selections and is able
// to identify a row via unique ID
selectionLayer.setSelectionModel(new RowSelectionModel<Person>(
selectionLayer, bodyDataProvider, new IRowIdAccessor<Person>() {
@Override
public Serializable getRowId(Person rowObject) {
return rowObject.getId();
}
}));
// register the DefaultRowSelectionLayerConfiguration that contains the
// default styling and functionality bindings (search, tick update)
// and different configurations for a move command handler that always
// moves by a row and row only selection bindings
selectionLayer.addConfiguration(new DefaultRowSelectionLayerConfiguration());
The best way to learn about NatTable is to have a look at the NatTable Examples Application. It is available as a WebStart application via the NatTable homepage. Or you can download the examples jar file and execute it from command line if WebStart doesn't work.
The example to look at is located under Tutorial Examples -> Layers -> Selection -> RowSelectionExample