我正在使用Primefaces 5.1.5和jsf 2.2。我们在tabView中使用了dataTable并用数据填充它,有些列没有呈现?!我通过developerTools检查了页面,它们实际上没有呈现,因为你可以在这里看到:
这是我们如何使用dataTable:
<p:dataTable emptyMessage="#{msgs['general.noEntriesFound']}"
value="#{manageContracts.pricesForContract}" var="price"
id="existingPrices" scrollHeight="200"
sortBy="#{finalPrice.price}" scrollable="true"
selectionMode="single" liveScroll="true" scrollRows="30"
selection="#{manageContracts.selectedPrice}"
rowKey="#{price.id}">
<p:ajax event="rowSelect"
listener="#{manageContracts.onPriceSelected}"
update=":form:tabView:newPrice"></p:ajax>
<f:facet name="header">
<p:outputLabel value="#{msgs['contract.prices']}" />
</f:facet>
<p:column headerText="#{msgs['contract.distanceFrom']}"
rendered="#{manageContracts.priceModelType == 'DISTANCE_BASED' || manageContracts.priceModelType == 'DISTANCE_BASED_NLC' || manageContracts.priceModelType == 'DISTANCE_BASED_NLC'}"
sortBy="#{price.fromDistance}"
filterBy="#{price.fromDistance}" filterMatchMode="contains"
filterStyle="width: 100%">
<h:outputText value="#{price.fromDistance}">
<f:convertNumber maxFractionDigits="0" />
</h:outputText>
</p:column>
<p:column headerText="#{msgs['contract.distanceFrom']}"
rendered="#{manageContracts.priceModelType == 'DISTANCE_BASED' || manageContracts.priceModelType == 'DISTANCE_BASED_NLC'}"
sortBy="#{price.toDistance}" filterBy="#{price.toDistance}"
filterMatchMode="contains" filterStyle="width: 100%">
<h:outputText value="#{price.toDistance}">
<f:convertNumber maxFractionDigits="0" />
</h:outputText>
</p:column>
<p:column headerText="#{msgs['contract.from']}"
rendered="#{manageContracts.priceModelType == 'REGION_BASED'}"
sortBy="#{price.fromDescription}"
filterBy="#{price.fromDescription}"
filterMatchMode="contains" filterStyle="width: 100%">
<h:outputText value="#{price.fromDescription}" />
</p:column>
<p:column headerText="#{msgs['contract.to']}"
rendered="#{manageContracts.priceModelType == 'REGION_BASED'}"
sortBy="#{price.toDescription}"
filterBy="#{price.toDescription}"
filterMatchMode="contains" filterStyle="width: 100%">
<h:outputText value="#{price.toDescription}" />
</p:column>
<p:column headerText="#{msgs['general.brand']}"
rendered="#{manageContracts.priceModelType != 'DISTANCE_BASED_NLC' and manageContracts.priceModelType != 'REGION_BASED_NLC'}"
sortBy="#{price.brandName}" filterBy="#{price.brandName}"
filterMatchMode="contains" filterStyle="width: 100%">
<h:outputText value="#{price.brandName}" />
</p:column>
<p:column headerText="#{msgs['general.type']}"
rendered="#{manageContracts.priceModelType != 'DISTANCE_BASED_NLC' and manageContracts.priceModelType != 'REGION_BASED_NLC'}"
sortBy="#{price.typeName}" filterBy="#{price.typeName}"
filterMatchMode="contains" filterStyle="width: 100%">
<h:outputText value="#{price.typeName}" />
</p:column>
<p:column headerText="#{msgs['general.model']}"
rendered="#{manageContracts.priceModelType != 'DISTANCE_BASED_NLC' and manageContracts.priceModelType != 'REGION_BASED_NLC'}"
sortBy="#{price.modelName}" filterBy="#{price.modelName}"
filterMatchMode="contains" filterStyle="width: 100%">
<h:outputText value="#{price.modelName}" />
</p:column>
<p:column headerText="#{msgs['contract.sizeCategory']}"
sortBy="#{price.wrapped.sizeCategory.categoryName}"
filterBy="#{price.wrapped.sizeCategory.categoryName}"
filterMatchMode="contains" filterStyle="width: 100%"
rendered="#{manageContracts.priceModelType == 'DISTANCE_BASED_NLC' || manageContracts.priceModelType == 'REGION_BASED_NLC'}">
<h:outputText
value="#{price.wrapped.sizeCategory.categoryName}" />
</p:column>
<p:column
headerText="#{msgs['contract.price']} (#{manageContracts.currency.name()})"
sortBy="#{price.finalPrice.price}"
filterBy="#{price.finalPrice.price}"
filterMatchMode="contains" filterStyle="width: 100%">
<h:outputText value="#{price.finalPrice.price}">
<f:convertNumber maxFractionDigits="2"
minFractionDigits="2" />
</h:outputText>
</p:column>
<p:column headerText="#{msgs['contract.validFrom']}"
sortBy="#{price.priceValidityFrom}"
filterBy="#{price.priceValidityFrom}"
filterMatchMode="contains" filterStyle="width: 100%">
<h:outputText value="#{price.priceValidityFrom}">
<f:convertDateTime pattern="dd.MM.yyyy"
timeZone="#{dateUtils.timeZone}" />
</h:outputText>
</p:column>
<p:column headerText="#{msgs['contract.validTo']}"
sortBy="#{price.priceValidityTo}"
filterBy="#{price.priceValidityTo}"
filterMatchMode="contains" filterStyle="width: 100%">
<h:outputText value="#{price.priceValidityTo}">
<f:convertDateTime pattern="dd.MM.yyyy"
timeZone="#{dateUtils.timeZone}" />
</h:outputText>
</p:column>
</p:dataTable>
有人有想法吗?
答案 0 :(得分:0)
您已在rendered
的{{1}}属性中合并了一些条件,请检查它们是否按预期工作。
我建议您复制<p:column>
属性的值并粘贴到其他任何位置,这样您就可以在页面中进行检查...只是为了检查它们是否都是rendered
,如果它是&#39;不是,然后专栏不会渲染。
true