p:dataTable does not work with ui:composition

UI Components for JSF
Post Reply
todlul
Posts: 2
Joined: 14 Mar 2011, 09:56

14 Mar 2011, 10:06

For some weeks now, I have tried to understand why my p:dataTable is not working properly. It shows all necessary information, but sorting, filtering, pagination etc are not working.
Now I have figured out, that it works as a simple xhtml-site without my template around it.

This is the code of my overview.xhtml. Not working with ui:composition etc, but when I replace it with h:head, h:body etc.

Code: Select all

<ui:composition template="/layout.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="menu">
        <ui:include src="menu.xhtml" />
    </ui:define>
    <ui:define name="content">
        <h1 class="title ui-widget-header ui-corner-all">DataTable - Complex</h1>
        <h:form>

            <p:dataTable var="car" value="#{tableBean.cars}" paginator="true" rows="10"
                         selection="#{tableBean.selectedCar}" selectionMode="single"
                         onRowSelectUpdate="display" onRowSelectComplete="carDialog.show()">

                <f:facet name="header">
                    List of Cars
                </f:facet>

                <p:column sortBy="#{car.car.model}" filterBy="#{car.car.model}">
                    <f:facet name="header">
                        <h:outputText value="Model" />
                    </f:facet>
                    <h:outputText value="#{car.car.model}" />
                </p:column>

                <p:column sortBy="#{car.car.build_year}" filterBy="#{car.car.build_year}">
                    <f:facet name="header">
                        <h:outputText value="Year" />
                    </f:facet>
                    <h:outputText value="#{car.car.build_year}" />
                </p:column>

                <p:column sortBy="#{car.car.manufacturer.name}" filterBy="#{car.car.manufacturer.name}">
                    <f:facet name="header">
                        <h:outputText value="Manufacturer" />
                    </f:facet>
                    <h:outputText value="#{car.car.manufacturer.name}" />
                </p:column>

                <p:column sortBy="#{car.car.class.simpleName}" filterBy="#{car.car.class.simpleName}">
                    <f:facet name="header">
                        <h:outputText value="Wut" />
                    </f:facet>
                    <h:outputText value="#{car.car.class.simpleName}" />
                </p:column>

            </p:dataTable>

            <p:dialog header="Car Detail" widgetVar="carDialog" resizable="false"
                      width="200" showEffect="explode" hideEffect="explode">

                <h:panelGrid id="display" columns="2" cellpadding="4">

                    <f:facet name="header">
                        <p:graphicImage value="/images/cars/#{tableBean.selectedCar.manufacturer}.jpg"/>
                    </f:facet>

                    <h:outputText value="Model:" />
                    <h:outputText value="#{tableBean.selectedCar.car.model}" style="font-weight:bold"/>

                    <h:outputText value="Year:" />
                    <h:outputText value="#{tableBean.selectedCar.car.year}" style="font-weight:bold"/>

                    <h:outputText value="Manufacturer:" />
                    <h:outputText value="#{tableBean.selectedCar.car.manufacturer}" style="font-weight:bold"/>

                    <h:outputText value="Color:" />
                    <h:outputText value="#{tableBean.selectedCar.car.class.simpleName}" style="font-weight:bold"/>
                </h:panelGrid>
            </p:dialog>

        </h:form>

    </ui:define>
</ui:composition>

I am using NetBeans 6.9.1 with GlassFish 3.0, JSF 2.0, Mojarra 2.0.2 and PrimeFaces 2.2

Greetings from germany,
todlul

frankee787
Posts: 15
Joined: 18 Jun 2011, 09:55

19 Jun 2011, 17:12

Did you ever figure out how to make it work ?

Alex
Posts: 256
Joined: 16 Dec 2010, 14:24
Location: Germany

19 Jun 2011, 17:25

just a guess, but make sure you do not have nested forms by having a form around the content in your template.
PrimeFaces 3.2
Mojarra 2.0.2
Glassfish 3.0.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests