1
votes

I added EditTextCell(stringTestEditTextCell) to Column(testColumn).

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

            return object.getValue();
        }
    };

All cells in testColumn are editable.

I want 1st cell of column such way that 1st cell of column should be Non-Editable.

2
The first cell of the column is non-editable? You mean a header? Why not a header? - Steve J
yes 1st cell of 1st column only non editable - StackOverFlow

2 Answers

1
votes

Following class is answer to my question. I Solved it and works fine. But getting error when user clicking on 1st cell of column.

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);
        }

    }
}
0
votes

You might extend EditTextCell and override the edit()-Method so that it only edits when you have not set a boolean flag that you that you need to set for the first cell.