2014-01-06 43 views

回答

2

當你在CellTable有一個EditTextCell,我假定你的意思是你有這樣整列:

Column<RowObject, String> editTextCellColumn = new Column<RowObject, String>(new EditTextCell()){ 

    @Override 
    public String getValue(RowObject object) { 

    // return the value that is supposed to be displayed in the EditTextCell 

    } 
}; 

如果是這樣的話,你可以簡單地添加該欄目的fieldupdater。每當用戶成功編輯文本單元格時,都會觸發FieldUpdater。

editTextCellColumn.setFieldUpdater(new FieldUpdater<RowObject, String>(){ 

    public void update(int index, final RowObject object, final String value) { 

     // 'value' is the new value the user entered in the EditTextCell. 
     // 'object' is the object that contains the old row information. 
     // 'index' is the current row index of 'object' 
     // Code for performing whatever you want to do with the new value goes here. 

    } 
}; 
相關問題