문제

I'm using a rich:dataTable and I want every other cell to have a different color (zebra color effect). How can I implement this in my .css file?

<rich:dataTable value="#{uploader.files}" var="_data" id="files">
    <rich:column>
        <f:facet name="header">
            <h:outputText value="File name" />
        </f:facet>
        <h:outputText value="#{_data.name}" />
</rich:column>
도움이 되었습니까?

해결책

Every cell should have a css class (.rf-cst-c it is in the actual richfaces showcase), so you could do something like:

.rf-cst-c:nth-child(odd) td {
        background: #000;
}
.rf-cst-c:nth-child(even) td {
        background: #5b5b5b;
}
.rf-cst-c:nth-child(3n) td {
        background: #fff;
}

If the css class is changing due to different versions of rich faces, it should be no problem to use your browser's debugging tools and get hold of the css class in use.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top