简体   繁体   English

Primefaces Datatable某些列未呈现

[英]Primefaces Datatable some columns not rendered

I'm using Primefaces 5.1.5 with jsf 2.2. 我正在使用带有jsf 2.2的Primefaces 5.1.5。 We used a dataTable in a tabView and populated it with data, some columns are not rendered?! 我们在tabView中使用了dataTable,并在其中填充了数据,某些列未呈现? I have inspected the page via developerTools and they really are not rendered as you can see here: 我已经通过developerTools检查了该页面,但实际上并没有如您在此处看到的那样呈现它们: 在此处输入图片说明

here is how we used the dataTable: 这是我们使用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>

anyone got an Idea ? 有人知道吗?

You have combined a few conditions in rendered attribute of <p:column> , please check if they are working as expected. 您已经在<p:column> rendered属性中组合了一些条件,请检查它们是否按预期工作。

I recommend you to copy the value of rendered attribute and paste anywhere else, so you can inspect in your page... Just to check if they are all true , if it's not, then the column won't render. 我建议您复制rendered属性的值并粘贴到其他任何地方,以便您可以在页面中进行检查...仅检查它们是否均为true ,否则,该列将不会呈现。

      ....
   </p:column>
</p:dataTable>
#{manageContracts.priceModelType == 'DISTANCE_BASED' || manageContracts.priceModelType == 'DISTANCE_BASED_NLC'}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM