【发布时间】:2016-11-29 22:34:12
【问题描述】:
【问题讨论】:
-
请显示您当前配置的代码
【问题讨论】:
使用RowSelectionModel。以下 sn-p 摘自 NatTable 示例的_5052_RowSelectionExample。
// 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());
了解 NatTable 的最佳方式是查看 NatTable 示例应用程序。它可通过NatTable homepage 作为WebStart 应用程序使用。或者,如果 WebStart 不起作用,您可以下载示例 jar 文件并从command line 执行。
要查看的示例位于 Tutorial Examples -> Layers -> Selection -> RowSelectionExample
【讨论】: