StackOverFlow
StackOverFlow

Reputation: 4614

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.

Upvotes: 1

Views: 1443

Answers (1)

StackOverFlow
StackOverFlow

Reputation: 4614

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.

Upvotes: 1

Related Questions