Re: Highlight some rows in CellTable
Ok, it works now.
First I override the default style by extending the
CellTable.Resources and CellTable.Style:
public interface CellTableResource extends CellTable.Resources {
/**
* The Interface CellTableStyle.
*/
public interface CellTableStyle extends CellTable.Style {
};
/*
* (non-Javadoc)
*
* <at> see
com.google.gwt.user.cellview.client.CellTable.Resources#cellTableStyle()
*/
<at> Override
<at> Source({ "SourceViewTable.css" })
CellTableStyle cellTableStyle();
};
Then I added the style with the defalt names, but without background
color setting.
If you set a background color in the style, you can't override it with
another style.
After that I used the setRowStyles function on the celltable, to set
the necessary background color:
codeTable.setRowStyles(new RowStyles<CodeViewerDto>() {
<at> Override
public String getStyleNames(CodeViewerDto row, int
rowIndex) {
if (row.isHighlighted()) {
if (rowIndex % 2 == 0) {
return "cellTableEvenRowHighlight";
} else {
return "cellTableOddRowHighlight";
}
} else {
if (rowIndex % 2 == 0) {
return "cellTableEvenRowBg";
} else {
return "cellTableOddRowBg";
}
}
}
});
--
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@...
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.