gwtcelllist

How can I style CellList items on a per-item basis?


I have a CellList in GWT 2.5. Each cell item is a class based on AbstractCell and defined in a UiBinder file.

How can I set different styles for each item? I'd like some to appear in a "disabled" style and others in an "active" style.

This is the content from my .ui.xml file. I've not included the style definitions or UiBinder scaffolding.

<div class="{style.contact}">
    <div>
        <div>
            <img class="{style.photo}" src="{photo}"/>
        </div>
        <div class="{style.names}">
            <div>
                <p><ui:text from="{name}"/></p>
                <p><ui:text from="{jobTitle}"/></p>
                <p><ui:text from="{company}"/></p>
            </div>
        </div>
    </div>
</div>

Solution

  • Use CellList.getRowElement():

    cellList.getRowElement(3).addClassName("css-disabled");
    cellList.getRowElement(4).addClassName("css-active");