@Override
protected String renderSummary(Map<String, Number> data, List<ColumnData> cs) {
List<ColumnData> csCopy = new ArrayList<ColumnData>();
// The totals row should never be blue. Strip out any background-color
// style.
for (ColumnData cdOrig : cs) {
ColumnData cd = copyColumnData(cdOrig);
csCopy.add(cd);
if (cd.style != null) {
int bgColorIndex = cd.style.indexOf("background-color");
if (bgColorIndex > -1) {
int endIndex = cd.style.indexOf(";", bgColorIndex);
StringBuilder sb = new StringBuilder(cd.style);
sb.delete(bgColorIndex, endIndex + 1);
cd.style = sb.toString();
}
}
}
return super.renderSummary(data, csCopy);
}
private ColumnData copyColumnData(ColumnData cdOrig) {
ColumnData cdCopy = new ColumnData();
cdCopy.id = cdOrig.id;
cdCopy.name = cdOrig.name;
cdCopy.style = cdOrig.style;
cdCopy.cellAttr = cdOrig.cellAttr;
cdCopy.css = cdOrig.css;
cdCopy.renderer = cdOrig.renderer;
return cdCopy;
}
Tuesday, July 10, 2012
Style Problem with Summary Row in Ext GWT (GXT) 2.5.5
I ran into a problem with styles in a SummaryColumnConfig. I was giving editable cells a blue background. When it got to the summary row, however, that cell was also being colored blue. The cell seems to use the last ColumnData.style value, so I needed a way to remove the background color on that cell. However, I had another section of grid after that summary row, and if I removed the color, the rest of the editable cells wouldn't have the blue background.
My solution was to override the renderSummary method in GroupSummaryView, copying the ColumnData so that the style I set would only apply to the summary row and wouldn't carry through to the next section:
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment