I want to make a Grid Cell editable based on the data in that cell.
The cell accepts a String. so, i am adding a Text editor as follow:
final GridInlineEditing<ModelData> editableGrid = new GridInlineEditing<ModelData>(grid);
int columnCount = grid.getColumnModel().getColumnCount();
final TextField text = new TextField();
for(int i=1;i<columnCount-1;i++)
{
final ColumnConfig<ModelData,String> config = grid.getColumnModel().getColumn(i);
editableGrid.addEditor(config, text);
}
and also.when i was creating the grid
config.setCell(new AbstractCell<String>() {
@Override
public void render(Context context, String value, SafeHtmlBuilder sb)
{
ModelData model = getGrid().getStore().get(context.getIndex());
if(null==value)
{
value = "";
}
if(model.getName().equals("vivek") {
sb.appendHtmlConstant("<div style=\"background-color:#E9967A;\">");
sb.appendHtmlConstant((String)value);
sb.appendHtmlConstant("</div>");
}
else{
sb.appendHtmlConstant("<span>" + value + "</span>");
}
}
});
But, i could not make the required field editable( I am able to make them colored).
getGrid(), is a method that simply returns the grid
Then, i tried with setting editor to TextField with Custom TextInputCell, but this does not accepts HTML.
So, how can i achieve this. Making a Grid cell editable, based on the data.