如何在列中覆盖(或忽略)行样式类?

时间:2016-11-16 11:53:26

标签: css primefaces datatable styles

我在我的DataTable上应用rowStyleClass,后者使用条件。

<style>
  .deleted {
    color: darkgray;
    text-decoration: line-through;
  }
  .normal {
  }
</style>

我希望最后两列不遵循规则,但以下都不起作用。

<p:dataTable
  rowStyleClass="#{placementsController.started(placement) ? 'started' : ''} #{empty placement.deleted ? '' : 'deleted'}">

    <!-- other columns here -->

    <p:column style="width: 60px; text-align: center;">
      <p:commandLink id="deleteLink" actionListener="#{placementsController.delete(placement)}" update="placementsTable">
        <h:outputText value="#{empty placement.deleted ? 'delete' : 'undelete'}" style="text-decoration: none !important;"/>
      </p:commandLink>
    </p:column>

    <p:column style="width: 50px;text-align: center; text-decoration: none !important;">
      <p:commandLink id="cloneCommand" action="#{placementsController.clone(placement)}" update="placementsTable">
        <h:outputText value="clone"/>
      </p:commandLink>
    </p:column>

</p:dataTable>

1 个答案:

答案 0 :(得分:0)

似乎对我有用:

.deleted > td:nth-last-child(1), .deleted > td:nth-last-child(2) {
    /* put the normal style here */
    color: red !important;
}