简体   繁体   中英

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.

How to avoid cell editing when validation fails.

if validation fail then editabletext cell value restored to old value.How to do that?

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)); cellTable.redraw();

Where cell is the TextEditCell that you're using for that column.

It´s usefull for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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