gpt4 book ai didi

html - 数据表内的 CSS primefaces panelgrid

转载 作者:可可西里 更新时间:2023-11-01 14:47:52 31 4
gpt4 key购买 nike

处理悬停事件时,我需要在数据表内的面板网格中放置背景色。我写了这个代码和这个 css,但没有任何反应。知道如何解决这个问题吗?

<p:dataTable id="movementsTable" var="mov" value="#{movementsBacking.movements}" selectionMode="single" selection="#{movementsBacking.selectedMovement}" rowKey="#{mov.id}"
styleClass="nopadding " rowStyleClass="roteiroTable" style="margin: 0;" emptyMessage="#{text['list.empty']}" >

<p:ajax event="rowSelect" update=":#{cc.clientId}:movementPanel" oncomplete="PF('movementPanelVar').show()" listener="#{movementsBacking.onSelect}"/>

<p:column headerText="#{text['tasksbacking.tabRot']}" sortBy="#{mov.dataSent}">

<p:panelGrid id="panelGridSelect" rendered="#{mov.isTreated()}" styleClass="borderless">
<p:row>
<p:column>
<h:outputLabel value="#{text['tasksbacking.roteiro.num']}" style="margin-right:5px;"/>
<h:outputText id="num" value="#{mov.number}"/>
</p:column>
<p:column>
<h:outputLabel value="#{text['tasksbacking.roteiro.data']}" style="margin-right:5px;"/>
<h:outputText value="#{mov.dataSent}">
<f:convertDateTime pattern="dd-MM-yyyy"/>
</h:outputText>
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputLabel value="#{text['tasksbacking.roteiro.de']}" style="margin-right:5px;"/>
<h:outputText value="#{mov.sender}" />
</p:column>
<p:column>
<h:outputLabel value="#{text['tasksbacking.roteiro.para']}" style="margin-right:5px;"/>
<h:outputText value=" #{mov.receiver}" />
</p:column>
</p:row>
<p:row>
<p:column colspan="2">
<!--<h:outputText value="#{text['tasksbacking.roteiro.resol']}"/>-->
<!--<h:outputText value="#{text['tasksbacking.true']}"/>-->
<h:outputLabel value="#{text['tasksbacking.roteiro.dataRes']}" style="margin-right:5px;"/>
<h:outputText value="#{mov.resolutionDate}">
<f:convertDateTime pattern="dd-MM-yyyy" />
</h:outputText>
</p:column>
</p:row>
<p:row>
<p:column colspan="2">
<h:outputLabel value="#{text['tasksbacking.registo.por']}" style="margin-right:5px;"/>
<h:outputText value="#{mov.resolutionUser.username}"/>
</p:column>
</p:row>
<p:row>
<p:column colspan="2">
<h:outputLabel value="#{text['tasksbacking.roteiro.resolution']}" style="margin-right:5px;"/>
<h:outputText value="#{of:abbreviate(mov.resolution.resolution, 80)}"/>
</p:column>
</p:row>
</p:panelGrid>

CSS代码:

.roteiroTable, .roteiroTable th, .roteiroTable td {
background-color: #F1F1F1 !important;
}

.nopadding, .nopadding th, .nopadding td {
padding: 0 !important;
}

.borderless, .borderless tr, .borderless td {
border: none !important;
}

最佳答案

你应该选择tr。下面的代码是一个例子。

<style>
.rowStyleX tr{
background-color: red !important;
}
</style>
<h:form>
<p:dataTable var="car"
value="#{dtBasicView.cars}"
rowStyleClass="rowStyleX">
<p:column headerText="Id">
<p:panelGrid>
<p:row>
<p:column>
<h:outputText value="car id: " />
</p:column>
<p:column>
<h:outputText value="#{car.id}" />
</p:column>
</p:row>
</p:panelGrid>
</p:column>

<p:column headerText="Year">
<h:outputText value="#{car.year}" />
</p:column>

<p:column headerText="Brand">
<h:outputText value="#{car.brand}" />
</p:column>

<p:column headerText="Color">
<h:outputText value="#{car.color}" />
</p:column>
</p:dataTable>
</h:form>

关于html - 数据表内的 CSS primefaces panelgrid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26166390/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com