1

EditTextCell(stringTestEditTextCell) を Column(testColumn) に追加しました。

EditTextCell editTextCell = new EditTextCell(); 列 stringColumn = new Column( editTextCell) { @Override public String getValue(Record object) {

            return object.getValue();
        }
    };

testColumn のすべてのセルは編集可能です。

列の最初のセルが編集不可になるように、列の最初のセルが必要です。

4

2 に答える 2

1

次のクラスは私の質問に対する答えです。私はそれを解決し、正常に動作します。ただし、ユーザーが列の最初のセルをクリックするとエラーが発生します。

class CustomEditTextCell extends EditTextCell{
    @Override
    public void render(com.google.gwt.cell.client.Cell.Context context,
            String value, SafeHtmlBuilder sb) {
        // context.getColumn()==2 indicate Record ID column and context.getIndex()==0 indicate non editable cell in 1st empty row
        if(context.getColumn()==2 &&    ( context.getIndex()==0  || context.getIndex()%10 == 0)){
            sb.appendHtmlConstant("<div contentEditable='false' unselectable='true'></div>");
        }else{
        super.render(context, value, sb);
        }

    }
}
于 2011-11-04T11:12:41.283 に答える
0

EditTextCellを拡張し、edit()-メソッドをオーバーライドして、最初のセルに設定する必要のあるブールフラグを設定していない場合にのみ編集するようにすることができます。

于 2011-11-02T09:39:57.357 に答える