【发布时间】:2012-01-12 05:39:16
【问题描述】:
。 . 我根据单元格的值为一列着色,但我想在 gxt 网格中为整行着色(意味着单元格包含的行)帮助我 这是我为单元格着色的代码(我想为行而不是单元格着色)
/*------------Coloring Area------------*/
GridCellRenderer<BeanModelType> ColoredGrid = new GridCellRenderer<BeanModelType>() {
@Override
public Object render(BeanModelType model,
String property, ColumnData config,
int rowIndex, int colIndex,
ListStore<BeanModelType> store,
Grid<BeanModelType> grid) {
String valueOfCell = model.get(property);
String style = valueOfCell.equals("Book") ? "GREEN":
valueOfCell.equals("Ersr") ? "red":
valueOfCell.equals("Pen") ? "yellow":
valueOfCell.equals("comp") ? "blue": "";
//Config is the cell and we are setting style here
config.style ="background-color:"+style;
return valueOfCell;
}
};
System.out.println("COLORRRRR "+cleanColoredGrid.toString());
column.setRenderer(ColoredGrid);
/*-------------Coloring Area Ends-------*/
configs.add(column);
【问题讨论】: