I am facing the issue related with jsf data table header. The requirement is to have the freez header for the data table. currently when the vertical scroll is there for data table and when we scroll down that time the data table header moving up. I want to keep it freez. The data table is geting generate from dynamically开发者_如何学运维 from java.
Can anybody please help me out?
Thanks!
You have to code the table header separately, above <h:dataTable>
.
Providing the columnclass and style of the header of your dataTable.
Here is an example:
<h:panelGrid id="panel" columns="4" columnClasses="rTypeColumn1,rTypeColumn2,rTypehColumn3,rTypeColumn4" styleClass="data-tableheader">
<h:outputLabel value="Column Name 1" />
<h:outputLabel value="Column Name 2" />
<h:outputLabel value="Column Name 3" />
<h:outputLabel value="Column Name 4"/>
</h:panelGrid>
<div class="scrollable">
<h:dataTable id="table" value="#{yourbean.list}" var="data" cellspacing="0" columnClasses="rTypeColumn1,rTypeColumn2,rTypeColumn3,rTypeColumn4" width="100%" styleClass="data-table">
<h:column>#{data.column1}</h:column>
<h:column>#{data.column2}</h:column>
<h:column>#{data.column3}</h:column>
<h:column>#{data.column4}</h:column>
</h:dataTable>
</div>
Rest is all about CSS you use. Alternatively, if you can use Richfaces, it provides scrollable datatable, core JSF datatable is fairly limited, its all what you can do with it.
You could use IceFaces 1.8, a JSF component system suitable for JSF 1.1. It contains a scrollbar for dataTable
精彩评论