简体   繁体   English

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

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

I want to used editableNumbercell like intger,decimal etc.. But there is no such gwt widget present so I am using editable text cell and using validation for numbers when user update value in cell. 我想使用诸如整数,小数等之类的editableNumbercell。但是不存在这样的gwt小部件,因此当用户更新单元格中的值时,我正在使用可编辑的文本单元格并使用数字验证。

How to avoid cell editing when validation fails. 验证失败时如何避免单元格编辑。

if validation fail then editabletext cell value restored to old value.How to do that? 如果验证失败,则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

            }

        }
    });

Any help or guidance in this matter would be appreciated. 在这方面的任何帮助或指导将不胜感激。

You can do it like this: 您可以这样做:

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

Where cell is the TextEditCell that you're using for that column. 其中cell是您用于该列的TextEditCell。

It´s usefull for me. 对我有用。

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

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