I can't belive I haven't seen the setCellStyleNames method! : ) Thanks for pointing me in the right direction again!
Am Freitag, 14. Dezember 2012 14:36:55 UTC+1 schrieb Thomas Broyer: > > Have a look at > Column#getCellStyleNames<http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/cellview/client/Column.html#getCellStyleNames%28com.google.gwt.cell.client.Cell.Context,+T%29>, > > override it as needed in your column. > > On Thursday, December 13, 2012 9:17:25 PM UTC+1, Alex opn wrote: >> >> I know this is pretty old but I face the same issue for a few hours now. >> Anybody found a solution or has an idea? I even tried crazy GQuery stuff >> but there is no event which indicates that the table/grid has been >> redrawn/drawn and so my tricks all didn't work sadly! >> >> Am Mittwoch, 23. März 2011 18:49:06 UTC+1 schrieb Raphaël Brugier: >>> >>> Hi, >>> >>> I've got a use case with the CellTable where a cell should be rendered >>> with a different background color depending on the cell content. I've also >>> some TD with a rowspan > 1. >>> I've implemented an AbstractCell to set a style depending on the status >>> (short version) : >>> >>> public class StatusCell extends AbstractCell<Status> { >>> @Override >>> public void render(final Status status, final Object key, final >>> SafeHtmlBuilder sb) { >>> String cellStyle; >>> if (status == Status.OK) { >>> cellStyle = "greenCell"; >>> } else { >>> cellStyle = "redCell"; >>> } >>> sb.appendHtmlConstant("<div class=\"" + cellStyle + >>> "\">"); >>> sb.appendEscaped(status.toString()); >>> sb.appendHtmlConstant("</div>"); >>> } >>> } >>> >>> Here is the result : >>> >>> <table class="cellTableWidget GA3XJ-DDEM"> >>> <thead> >>> <tr> >>> <th class="cellTableHeader GA3XJ-DDIC" >>> colspan="1">Product</th> >>> <th class="cellTableHeader" colspan="1">Status</th> >>> </tr> >>> </thead> >>> <colgroup></colgroup> >>> <tbody style=""> >>> <tr class="GA3XJ-DDEC" onclick=""> >>> <td class="cellTableCell cellTableEvenRowCell >>> cellTableFirstColumn"> >>> <div tabindex="0" style="outline: medium none;">car</div> >>> </td> >>> <td class="cellTableCell cellTableEvenRowCell" rowspan="2"> >>> <div style="outline: medium none;"> >>> <div class="greenCell">OK</div> >>> </div> >>> </td> >>> </tr> >>> <tr class="GA3XJ-DDEC" onclick=""> >>> <td class="cellTableCell cellTableEvenRowCell >>> cellTableFirstColumn"> >>> <div tabindex="0" style="outline: medium none;">car</div> >>> </td> >>> </tr> >>> <tr class="GA3XJ-DDEC" onclick=""> >>> <td class="cellTableCell cellTableEvenRowCell >>> cellTableFirstColumn"> >>> <div tabindex="0" style="outline: medium none;">car</div> >>> </td> >>> <td class="cellTableCell cellTableEvenRowCell"> >>> <div style="outline: medium none;"> >>> <div class="redCell">KO</div> >>> </div> >>> </td> >>> </tr> >>> </tbody> >>> </table> >>> >>> But the point is that when the cell is rendered by the CellTable view, >>> it encapsulates it inside an other DIV and then put it in the TD. Then my >>> Div where I have applied a style will not have the max height of the TD so >>> the background color will not be fully applied to the TD. (The green of the >>> OK cell does not extend to the TD) >>> >>> >>> I got two ideas : >>> 1/ Use css to extends the DIV to be the height of the TD. But setting >>> height: 100% did not work. >>> 2/ Find a way to set manually a style to the <TD>. But there is nothing >>> on the CellTable api to access the TD after they have been rendered. >>> >>> Is anybody have encountered this use case or have a solution please ? >>> >>> Thanks in advance. >>> >>> >>> >>> >>> -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/iH5TW089cbMJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.