1
votes

I'm using Primefaces 5.1.5 with jsf 2.2. We used a dataTable in a tabView and populated it with data, some columns are not rendered?! I have inspected the page via developerTools and they really are not rendered as you can see here: enter image description here

here is how we used the 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 ?

1

1 Answers

0
votes

You have combined a few conditions in rendered attribute of <p:column>, please check if they are working as expected.

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.

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