PDA

View Full Version : Possible Bug on EditorGrid prevents from changing cell background color



Noggy
13 Feb 2009, 11:40 AM
Hi all !
I'm still stuck at trying to change a grid cell background color. After my last attemp,
i'm beginning to be convinced it's a bug on GXT.

Here's the sample code


List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig scheduleName = new ColumnConfig();;

GridCellRenderer<PortionGridDrawModel> change = new GridCellRenderer<PortionGridDrawModel>() {


public String render(PortionGridDrawModel model,String property, ColumnData config, int rowIndex,
int colIndex, ListStore<PortionGridDrawModel> store) {

String style = "black";
String temp = model.get(property);


return "<span style='background-color:'"+style+"'>"+temp+"</span>";;

}
};


scheduleName = new ColumnConfig();
scheduleName.setId("portionName");
scheduleName.setWidth(150);
scheduleName.setMenuDisabled(true);
scheduleName.setResizable(false);
scheduleName.setRenderer(change);
configs.add(scheduleName);

ColumnModel cm = new ColumnModel(configs);


EditorGrid<PortionGridDrawModel> grid = new EditorGrid<PortionGridDrawModel>(scheduleListStore, cm);
grid.setBorders(false);
grid.setClicksToEdit(ClicksToEdit.TWO);
grid.disableTextSelection(true);

GWT version : 1.5.3
GXT version : 1.2

TIA,
Carlos

Noggy
16 Feb 2009, 2:50 AM
Issue solved.
Please correct the online example to include escape characters !!!!

Inside the render method i had to use instead :


String style = "background-color:red; width:100%;";
String temp = model.get(property);
return "<span style=\""+style+"\">"+temp+"</span>";