The moose likes JSF and the fly likes h:panelGrid and thead rows Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "h:panelGrid and thead rows" Watch "h:panelGrid and thead rows" New topic
Author

h:panelGrid and thead rows

veli akcakaya
Greenhorn

Joined: Dec 19, 2008
Posts: 7
Hi,
i'm trying to make a table including <thead> row via <h:panelGrid. But i couldnt code for thead columns. I tried to use <f:facet, but it not same as my want.

<f:facet name="header">
<hutputText value="header"/>
</f:facet>


How can i make this table by <h:panelGrid
<table>
<thead>
<tr>
<th align="left">Thead1</th>
<th align="left">Thead2</th>
<th align="right">Thead3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1 - Col 1</td>
<td>Row 1 - Col 2</td>
<td align="right">Row 1 - Col 3</td>
</tr>
<tr>
<td>Row 2 - Col 1</td>
<td>Row 2 - Col 2</td>
<td align="right">Row 2 - Col 3</td>
</tr>
</tbody>
</table>

Have a nice day.
Thiebaut olivier
Greenhorn

Joined: Jul 10, 2008
Posts: 14
Hello,

It 's a simple example

you mustuse <h:column> for each column like this.

<h:column>
<f:facet name="header">
<hutputText value="Thead1"/>
</facet>
<hutputText value="row1">
</h:column>
<h:column>
<f:facet name="header">
<hutputText value="Thead2"/>
</facet>
<hutputText value="row2">
</h:column>

-Thead1-Thead2
-row1-row2
for a new column ,you add the same example
that's all
olivier
veli akcakaya
Greenhorn

Joined: Dec 19, 2008
Posts: 7
Hi Olivier,

i try your suggestion. my code is;

<h:panelGrid columns="2">
<h:column>
<f:facet name="header">
<hutputText value="Thead1"/>
</f:facet>
<hutputText value="row1" />
</h:column>
<h:column>
<f:facet name="header">
<hutputText value="Thead2"/>
</f:facet>
<hutputText value="row2" />
</h:column>
</h:panelGrid>

and result of this code ;

<table>
<tbody>
<tr>
<td>row1</td>
<td>row2</td>
</tr>
</tbody>
</table>

it is not include <thead>.

Do you have any else suggestion.

Thanks,
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
That's not possible with h:panelGrid. That's only possible with h:dataTable.

If the amount of cells is known beforehand, you can also just use a plain vanilla HTML table instead.


Code depot of a Java EE / JSF developer | JSF / Eclipse / Tomcat kickoff tutorial | DAO kickoff tutorial | I ♥ Unicode
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: h:panelGrid and thead rows
 
Similar Threads
Problem with table row overlapping with table header
Scroll table within a table not working
Table with fixed header and scolling body in Safari.
Scrolling problem with JSF
how to position div over table