簡體   English   中英

如何使用來自實體的信息為整行着色?

[英]How I can color the entire row using the information from the entity?

我在 .xhtml 文件中有下表。 我想為表格的整行着色,而不僅僅是文本背景。 我怎么能做到這一點? 注意:表格有更多的列,我只是在這里發布了其中的一列,因為其余的列是相似的。

<rich:panel styleClass="container dynamic grey table col7">

                    <f:facet name="header">#{msg.toop_normalverteilungstest_results}</f:facet>

                          

                    <rich:dataTable styleClass="dynamic equicol7" value="#{normalverteilungstestBean.statisticResultsList}" var="stat" id="table">


                           <rich:column id="testschritteVal" styleClass="col1-table" headerClass="col1-table">

                                  <f:facet name="header">

                                        <h:outputText value="#{msg.masterdata_normalverteilungstest_testschritte}"/>

                                  </f:facet>

                                  <h:outputLabel rendered="#{stat.color == 'g'}" style="background-color:MediumSeaGreen;" value="#{stat.testschritte}" styleClass="col1"/>

                                  <h:outputLabel rendered="#{stat.color == 'r'}" style="background-color:Tomato;" value="#{stat.testschritte}" styleClass="col1"/>

                                  <h:outputLabel rendered="#{stat.color == 'w'}" value="#{stat.testschritte}" styleClass="col1"/>

                           </rich:column>
                    </rich:dataTable>
             </rich:panel>

rowClass屬性。 只需將其與 CSS 結合即可。 例如:

<style>
    tr.g { background-color: MediumSeaGreen; }
    tr.r { background-color: Tomato; }
    tr.w { background-color: white; }
</style>

rowClass="#{stat.color}"rich:dataTable

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM