我是GWT的新手,我一直试图获得一个在cellTable中的EditTextCell的值,所以我想知道实现这个目标的最佳方法是什么?
由于
答案 0 :(得分: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.
}
};