File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Header, Footer with dynamic data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Header, Footer with dynamic data" Watch "Header, Footer with dynamic data" New topic
Author

Header, Footer with dynamic data

Raja Pam
Greenhorn

Joined: Jan 04, 2011
Posts: 19
Hi,

I want to display dynamic header, dynamic footer, with dynamic data in column.
I tried with following code:

<rich:dataTable id="report" value="#{viewClass.resultList}" var="list">
<f:facet name="header">
<rich:columnGroup>
<rich:column>
<a4j:commandLink value="Header1" actionListener="#{viewClass.sortTable}"/>
</rich:column>
<rich:column>
<hutputText value="Header2" />
</rich:column>
<rich:column>
<hutputText value="Header3" />
</rich:column>
<rich:column>
<hutputText value="Header4" />
</rich:column>
<rich:column>
<hutputText value="Header5" />
</rich:column>
<rich:column>
<hutputText value="Header6" />
</rich:column>

</f:facet>
<rich:subTable value="#{viewClass.resultList}" var="item1" >
<rich:column>
<hutputText value="#{item1.header1}"></hutputText>
</rich:column>

<rich:column>
<hutputText value="#{item1.header2}"></hutputText>
</rich:column>

<rich:column>
<hutputText value="#{item1.header3}"></hutputText>
</rich:column>

<rich:column>
<hutputText value="#{item1.header4}"></hutputText>
</rich:column>

<rich:column>
<hutputText value="#{item1.header5}"></hutputText>
</rich:column>

<rich:column>
<hutputText value="#{item1.header6}"></hutputText>
</rich:column>
</rich:subTable>

<f:facet name="footer">
<rich:columnGroup>
<rich:column>
<rich:spacer></rich:spacer>
</rich:column>
<rich:column rowspan = 2>Totals</rich:column>
<rich:column>
<hutputText value="#{viewClass.tot1}"></hutputText>
</rich:column>
<rich:column>
<hutputText value="#{viewClass.tot2}"></hutputText>
</rich:column>
<rich:column>
<hutputText value="#{viewClass.tot3}"></hutputText>
</rich:column>
<rich:column>
<hutputText value="#{viewClass.tot4}"></hutputText>
</rich:column>
</rich:columnGroup>
</f:facet>

</rich:dataTable>

But Output is coming as :

Header1 Header2 Header3 Header4 Header5 Header6
a1 a2 a3 a4 a5 a6
b1 b2 b3 b4 b5 b6
c1 c2 c3 c4 c5 c6
a1 a2 a3 a4 a5 a6
b1 b2 b3 b4 b5 b6
c1 c2 c3 c4 c5 c6
a1 a2 a3 a4 a5 a6
b1 b2 b3 b4 b5 b6
c1 c2 c3 c4 c5 c6
Total 12 23 45 22

Same data got repeated 3 times for 3 sets of records, 4 times for 4 sets of record i.e n times for n set of records..

Someone Please please please respond and help.


Guy deLyonesse
Ranch Hand

Joined: Apr 12, 2011
Posts: 200

Your headers and data should be in the same column, not separated.
Raja Pam
Greenhorn

Joined: Jan 04, 2011
Posts: 19
Thanks a lot...

Done in the same way... Issue is resolved...

Thanks you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Header, Footer with dynamic data
 
Similar Threads
Sprites disappearing after scaling down window? Aaargh the frustration!
help!!!a problem about java gui
JTree data from database
Operator precedence and associativity confusion........
Magic Square water retention