<table id="tbl" cellpadding="5" cellspacing="0" border="0" class="display" style="padding-top: 10px;width:100%">
<thead>
<tr>
<th width="20%">Emp No</th>
<th width="15%">title</th>
<th width="20%">Name</th>
<th width="10%">shift</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</tfoot>
<tbody style="cursor:pointer;">
Yeh aik arzi tehreer hai
</tbody>
</table>
When I started to convert this code for my JSF app I found that I can use either <h:dataTable>
or <h:panelGrid>
because both are use here as an alternative of table in html
.So first thing which I want to ask is what should I use here?
2ndly how can I handle <thead>
, <tfoot>
and <tbody>
as I didn't find their alternate in JSF.So please can anyone put some effort to help me for this
Thanks
<h:dataTable>
is a good choice if you have (in your backing bean) a set of objects you need to display. For example if you have a List of object Employee (with Id, Name, Surname, etc.) then is the best choice.
Here you can find an example of how to use dataTable.
<h:panelGrid>
is a good choice if you have layout various elements in an certain way. One case, is when you have to split the space in two columns of 80% and 20% respectively.
Though, 'I' suggest to use (panelGroup) for this purpose see http://www.w3.org/2002/03/csslayout-howto
Edit: With the <h:dataTable>
For the header, footer, etc. you have to use the tag <f:facet />
see Multiple Footer Rows in a JSF dataTable