我想根据条件更改行的颜色吗?

时间:2019-07-11 10:20:06

标签: css primefaces

我有一个数据表,我想让PrincipalRemainder的值等于0的行变成红色

数据表代码

                <p:dataTable id="realoplist" var="repop" value="#{amortizationBean.repayments}" tableStyle="width:auto" 
                             paginator="true" rows="12" paginatorAlwaysVisible="false" emptyMessage="#{msg.empty_table}" rowStyleClass="#{repop.principalRemainder eq 0 ? 'old' : null} ">
                    <p:column headerText="Планиран падеж">
                        <rs:outputDate date="#{repop.repaymentDate}" />
                    </p:column>

                    <p:column headerText="Дължима лихва" styleClass="money">
                        <rs:outputMoney value="#{repop.interestSum}" />
                    </p:column>

                    <p:column headerText="Дължима главница" styleClass="money" >
                        <rs:outputMoney value="#{repop.principalSum}" />
                    </p:column>

                    <p:column headerText="Лихвен %" styleClass="money">
                        <rs:outputMoney value="#{repop.interestRate}" />
                    </p:column>

                    <p:column headerText="Общо вноска" styleClass="money">
                        <rs:outputMoney value="#{repop.interestSum.add(repop.principalSum)}" />
                    </p:column>

                    <p:column headerText="Оставаща главница" styleClass="money">
                        <rs:outputMoney value="#{repop.principalRemainder}" />
                    </p:column>

                    <p:column headerText="Оставаща лихва" styleClass="money">
                        <rs:outputMoney value="#{repop.interestRemainder}" />
                    </p:column>

                    <p:column headerText="Платена наказателна лихва" styleClass="money">
                        <rs:outputMoney value="#{repop.paidPenalty}" />
                    </p:column>

                </p:dataTable>

以及body标记中的css代码

        <style type="text/css">
.old {
    background-color: #fca752 !important;
    background-image: none !important;
    color: #000000 !important;
}

0 个答案:

没有答案