我想使用可编辑的数字单元,如整数、小数等。但是没有这样的 gwt 小部件,所以我使用可编辑的文本单元格并在用户更新单元格中的值时使用数字验证。
验证失败时如何避免单元格编辑。
如果验证失败,则可编辑文本单元格值恢复为旧值。如何做到这一点?
intgerColumn.setFieldUpdater(new FieldUpdater<RecordInfo, String>() {
public void update(int index, RecordInfo object, String value) {
// Called when the user changes the value.
if(value.matches("(-)?(\\d){1,8}")){
object.setColumnInRecordEdited(true);
object.setValue(value);
RecordData.get().refreshDisplays();
}else{
Window.alert("Specify valid integer value for parameter");
// How to rest old value here? currently update value set to cell
}
}
});
在此问题上的任何帮助或指导将不胜感激。