DataTable dynamic columns and grouping

UI Components for JSF
Post Reply
zambrovski
Posts: 3
Joined: 10 Jul 2010, 16:21
Location: Hamburg, Germany
Contact:

08 Mar 2011, 02:04

Hi Folks,

Thanks for improving the Primefaces...

I'm trying to combine two powerfull features of Primefaces 2.2 : dynamic columns and column grouping. My task is to create a two level header: in the first level header, the columns have a colspans of three and the second level header is just a normal one. The difficulty is thst the header must be dynamic.

I tried this:

Code: Select all

<p:dataTable var="swimlane" value="#{scheduleController.swimlanes}">
	          <p:columnGroup type="header">
			<p:row>
				<ui:repeat var="dayHeader" value="#{scheduleController.columns}">  
					<p:column colspan="3" headerText="#{dayHeader.offset}" />															
   				</ui:repeat> 				
			</p:row>
			<p:row>
				<ui:repeat var="shiftHeader" value="#{scheduleController.shifts}">  
					<p:column headerText="#{shiftHeader.shift}" />															
   				</ui:repeat> 				
			</p:row>
		</p:columnGroup>
         <...>
But it doesn't work. And <p:columns> doesn't support colspan/rowspan attributes.


Any ideas?


Kind regards,

Simon

P.S. Just bought the manual but didn't find the answer there...
--
PrimeFaces: 2.2, JSF 2.0: Mojarra

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Mar 2011, 08:06

We've never tried merging these two features together so if you think there is a limitation here, feel free to create an enhancement request.

andrew86
Posts: 38
Joined: 24 Apr 2013, 16:16

30 Oct 2013, 17:40

I've had this same issue and I've noticed that c:forEach works well:

Code: Select all

<p:columnGroup id="colGroup" type="header" >
<p:row >
	<p:column colspan="1" width="20"  />
	<p:column colspan="3" headerText="Information" width="360" />

	<c:forEach items="${yardMaster.blockVolHours}" var="hour" >
		<p:column colspan="${hour.colspan}" headerText="${hour.hour}" width="${hour.colspan * 90}" />
	</c:forEach>
</p:row>
Primefaces 4.0; JSF 2.1.24; Apache Tomcat 7.0.30; Mojarra 2.1.24; Omnifaces 1.5

sreenivasulu.n
Posts: 36
Joined: 19 Jul 2013, 11:01

03 Jun 2014, 14:09

andrew86 wrote:I've had this same issue and I've noticed that c:forEach works well:

Code: Select all

<p:columnGroup id="colGroup" type="header" >
<p:row >
	<p:column colspan="1" width="20"  />
	<p:column colspan="3" headerText="Information" width="360" />

	<c:forEach items="${yardMaster.blockVolHours}" var="hour" >
		<p:column colspan="${hour.colspan}" headerText="${hour.hour}" width="${hour.colspan * 90}" />
	</c:forEach>
</p:row>

i have tried as you said above, but it is not working for me.

And My Xhrml Code is here below :

Code: Select all

<p:dataTable value="#{templateBean.headerRows}" var="row" id="tab2"
                  style="width:100%;overflow:auto;"
                  emptyMessage="Template Preview is not available">
                  <p:columns value="#{templateBean.headerPreview}"
                     style="height:20px;" headerText=" #{column}" var="column">
                     <f:facet name="header">
                        <h:outputLabel value="#{column}" />
                     </f:facet>
                     <h:outputLabel value="#{row[column]}" rendered="false" />
                  </p:columns>
               </p:dataTable>
Can you explain clearly please?
Sreenivasulu N
Primefaces-5.0
primefaces-extensions-2.0
JSF2.1.7
JBoss 7.1.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests