smiletolead
12 Nov 2009, 4:28 AM
Hi all,
I want to apply custom cell rendering for the CheckBox column in GXT Grid. That is, I am using CheckBoxSelectionModel plugin to GXT grid. I want apply background color to the first cell as well as the rest of the cells. I am doing it through a GridCellRenderer that applies this style. The render method of GridCellRenderer looks like this:
GridCellRenderer<ModelData> selectionRenderer = new GridCellRenderer<ModelData>() {
public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<ModelData> store, Grid<ModelData> grid) {
// config.
if (rowIndex == 4 || rowIndex == 6)
config.style = "background-color:blue;";
else
config.style = "";
return "";
}
};
final CheckBoxSelectionModel<ModelData> sm = new CheckBoxSelectionModel<ModelData>();
sm.getColumn().setRenderer(selectionRenderer);
But this is causing the grid to be rendering improperly. The checkboxes are not rendered properly.
Can anyone please tell me what is wrong in here. Is GridCellRenderer the way to modify the CheckBox column or is there any other way.
The version of GXT I am using is GXT 2.0.1
Regards,
Ganesh
I want to apply custom cell rendering for the CheckBox column in GXT Grid. That is, I am using CheckBoxSelectionModel plugin to GXT grid. I want apply background color to the first cell as well as the rest of the cells. I am doing it through a GridCellRenderer that applies this style. The render method of GridCellRenderer looks like this:
GridCellRenderer<ModelData> selectionRenderer = new GridCellRenderer<ModelData>() {
public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<ModelData> store, Grid<ModelData> grid) {
// config.
if (rowIndex == 4 || rowIndex == 6)
config.style = "background-color:blue;";
else
config.style = "";
return "";
}
};
final CheckBoxSelectionModel<ModelData> sm = new CheckBoxSelectionModel<ModelData>();
sm.getColumn().setRenderer(selectionRenderer);
But this is causing the grid to be rendering improperly. The checkboxes are not rendered properly.
Can anyone please tell me what is wrong in here. Is GridCellRenderer the way to modify the CheckBox column or is there any other way.
The version of GXT I am using is GXT 2.0.1
Regards,
Ganesh