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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to