Question

I have common form with panelGrid:

<h:form id="formId">
            <p:panelGrid columns="2" id="sdf">
                         <ui:include src="row1.xhtml"/>
                         <ui:include src="row2.xhtml"/>
                     </p:panelGrid>
 </form>

and two nested pages. row1.xhtml:

<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:p="http://primefaces.org/ui">
    <h:outputText value="Text  (column 1)"/>
    <p:commandButton value="Batton (column 1)"/>
</ui:fragment>

and row2.xhtml:

<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:p="http://primefaces.org/ui">
    <h:outputText value="Text  (column 2)"/>
    <p:commandButton value="Batton (column 2)"/>
</ui:fragment>

In this case panelGrid work for pages, not for components (outputText and commandButton):

Text (column 1) Button (column 1)

Text (column 2) Button (column 2)

But I need this one:

Text (column 1) Button (column 2)

Text (column 1) Button (column 2)

I can't have all component in one page, because I pass parameters into nested pages and this is - re used components, but I need support alignment in accordance with the first column.

I use: PrimeFaces 3.5 with JSF 2.1.22

Thanks in advance!

Was it helpful?

Solution

I have found an answer on PrimeFaces forum. It should use ui:composition instead of ui:fragment.

"From the docu "ui:fragment is the same as the ui:composition, except for two things: JSF creates a component and adds it directly to the tree, and there's no associated template."

link

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top