日期:2014-05-16 浏览次数:20493 次
一、方案一
?
1.使用MyFaces的扩展组件Tomahawk 1.1.9的<t:dataTable>和<t:dataScroller>标签
2.例子
?
<h:form prependId="false">
<t:panelGrid>
<t:saveState value="#{viewCustomerInfo.customerInfos}"/>
<t:dataTable id="paginator" value="#{viewCustomerInfo.customerInfos}" var="info" preserveDataModel="false" rows="3" styleClass="tb1" width="100%" border="0" cellspacing="0" cellpadding="0">
<h:column>
<f:facet name="header"><h:outputText value="code"/></f:facet>
<h:outputText value="#{info.customerCode}"/>
</h:column>
<h:column>
<f:facet name="header"><h:outputText value="name"/></f:facet>
<h:outputText value="#{info.customerName}"/>
</h:column>
</t:dataTable>
<t:dataScroller id="scroller" paginator="true" paginatorMaxPages="9" fastStep="5" paginatorActiveColumnStyle="font-weight:bold;" for="paginator" immediate="true">
<f:facet name="first">
<t:graphicImage url="../img/page/first.jpg" border="1" width="20px" height="18px"/>
</f:facet>
<f:facet name="fastrewind">
<t:graphicImage url="../img/page/rewind.jpg" border="1" width="20px" height="18px"/>
</f:facet>
<f:facet name="previous">
<t:graphicImage url="../img/page/previous.jpg" border="1" width="20px" height="18px"/>
</f:facet>
<f:facet name="next">
<t:graphicImage url="../img/page/next.jpg" border="1" width="20px" height="18px"/>
</f:facet>
<f:facet name="fastforward">
<t:graphicImage url="../img/page/forward.jpg" border="1" width="20px" height="18px"/>
</f:facet>
<f:facet name="last">
<t:graphicImage url="../img/page/last.jpg" border="1" width="20px" height="18px"/>
</f:facet>
</t:dataScroller>
</t:panelGrid>
</h:form>
?
3.?说明:
(1)使用一组dataTable和dataScroller标签,其中dataTable必须指定id和rows(当然还有value)
(2)将dataScroller的for属性的值设置为dataTable的id来完成关联(如果将dataScroller嵌套在dataTable的内部