繁体   English   中英

GWT CELLTABLE如何在EditableTextCell中恢复旧值?

[英]GWT CELLTABLE How to restore old value in EditableTextCell?

我想使用诸如整数,小数等之类的editableNumbercell。但是不存在这样的gwt小部件,因此当用户更新单元格中的值时,我正在使用可编辑的文本单元格并使用数字验证。

验证失败时如何避免单元格编辑。

如果验证失败,则editabletext单元格值恢复为旧值。该怎么办?

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

            }

        }
    });

在这方面的任何帮助或指导将不胜感激。

您可以这样做:

//清除错误的数据单元格。clearViewData(KEY_PROVIDER.getKey(object)); cellTable.redraw();

其中cell是您用于该列的TextEditCell。

对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM