2016-07-26 39 views

回答

1

使用RowSelectionModel。以下片段摘自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執行它。

看看下實例教程所在的例子 - >圖層 - >選擇 - > RowSelectionExample

相關問題