2011-09-28 62 views
0

有什么办法可以实现可滚动数据表而不使用Rich Faces?如果有人可以指向我的代码示例或示例页面吗?谢谢。JSF - 可滚动数据表

回答

1

这可以通过CSS来实现。您必须使用css属性overflow:scroll或overflow-x和overflow-y。但请注意,不同的浏览器会以不同的方式处理此属性,因此您可能会导致不同的行为。

你在一个div中做一个h:dataTable包装。 使用css更改div的属性并添加overflow属性以进行滚动。 确保您的桌子有固定尺寸。

你可能想看看这个

http://anaturb.net/csstips/sheader.htm

-cheers :)在JSF滚动数据表

2

使用div组件,并在style属性提 性能height: 200px; overflow: auto;

<div style="height: 200px; overflow: auto;"> 
    <h:dataTable value="#{facesBean.files}" var="file"> 
     <h:column> 
      <f:facet name="header"> 
       <h:outputText value="Image"></h:outputText> 
      </f:facet> 
      <h:graphicImage value="#{files.image}" style="width:100px; height:100px;"></h:graphicImage> 
     </h:column> 
     <h:column> 
      <f:facet name="header"> 
       <h:outputText value="Description"></h:outputText> 
      </f:facet> 
      <h:outputText style="font-weight:bold;" value="File Name:"></h:outputText> 
      <h:outputText value="#{file.alt}"></h:outputText> 
     </h:column> 
    </h:dataTable> 
</div>