簡體   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