我想知道如何做一个 ui:repeat 多页,我点击上一个/下一个按钮来查看下一组数据。
目前我有一个 ui:repeat
<ui:repeat id="repeat5" value="#{getData.data}" var="lst2" varStatus="loop">
我可以按行/列查看内容(基本上是图像),但所有数据都显示在同一屏幕上,但我只想显示 5 行和 4 列,然后使用上一个/下一个按钮查看剩余的图像5 行/ 4 列布局。
目前我只能指定如下所示的列配置,如何获取指定的行。
<h:panelGrid id="panelGrid3" columns="4" cellspacing="2" cellpadding="2">
更新 1(Rasmus Franke 的代码)
请根据您的要求找到代码。
<h:form id="mainForm">
<p:tabView id="tabView" >
<p:tab title="Image Viewer" id="Viewer" titleStyle="height:30px">
<p:layout>
<p:layoutUnit id="layoutEast" position="east" size="350" style="height:200px">
<p:commandButton type="button" onclick=""
icon="ui-icon-circle-triangle-w"/>
<p:commandButton type="button" onclick="switchPage(1,29);"
icon="ui-icon-circle-triangle-e"/>
<h:panelGrid id="panelGrid3" columns="5" cellspacing="2" cellpadding="2">
<ui:repeat id="repeat5" value="#{getData.data}" var="imagesLst2" varStatus="loop">
<h:panelGroup>
<p:commandLink id="cl3" action="#{getData.imageID(imagesLst2.imageID)}" update=":mainForm:tabView:example">
<p:graphicImage id="gi3" value="#{imagesStreamer.image}" styleClass="bord"
onmousedown="mouseDown(this)" alt="image not available3" width="60" height="60"
style="#{loop.index > 29 ? 'visibility: hidden;' : ''}">
<f:param name="id5" value="#{imagesLst2.imageID}" />
</p:graphicImage>
</p:commandLink>
</h:panelGroup>
</ui:repeat>
</h:panelGrid>
</p:layoutUnit>
</p:layout>
</p:tab>
</p:tabView>