JSF 1.1数据表标头冻结问题.向下滚动到数据表时,标题向上移动 [英] JSF 1.1 data table header freezing issue. Header is moving up when scroll down in to the data table
问题描述
我正面临与jsf数据表标头有关的问题.要求是具有数据表的freez标头.当前,当数据表存在垂直滚动时,当我们向下滚动时,数据表标题将向上移动.我想让它保持冻结状态.数据表是从Java动态生成的.
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.
有人可以帮我吗?
谢谢!
推荐答案
您必须在<h:dataTable>
上方单独编码表头.
提供数据表标题的columnclass和样式.
You have to code the table header separately, above <h:dataTable>
.
Providing the columnclass and style of the header of your dataTable.
这里是一个例子:
<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与您使用的CSS有关. 另外,如果您可以使用 Richfaces ,它提供了可滚动的数据表,核心的JSF数据表相当有限,您可以使用它进行所有操作.
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.
这篇关于JSF 1.1数据表标头冻结问题.向下滚动到数据表时,标题向上移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!