JSF - 使用 Tomahawk 实现分页

发布于 2024-10-08 15:05:45 字数 1687 浏览 0 评论 0原文

我正在尝试使用 Tomahawk 在 JSF 中实现分页。加载页面时,第一页中的表将填充数据。但是,当我单击“下一步”或“上一步”时,表为空。我在浏览器中没有看到任何 JavaScript 错误。以下是jsp中的代码。如果我遗漏了什么,请告诉我:

<t:dataTable id="tableid" value="#{SiteSearchCriteria.siteList}"
        var="item" border="1" rows="5" rowIndexVar="rowIndex"
        rowClasses="trobg1,trobg2">
        <h:column>
            <f:facet name="header">
                <h:outputText value="siteName"></h:outputText>
            </f:facet>
            <h:outputLabel value="#{item.siteName}"></h:outputLabel>
        </h:column>

        <h:column>
            <f:facet name="header">
                <h:outputText value="siteCLLI"></h:outputText>
            </f:facet>
            <h:outputLabel value="#{item.siteCLLI}"></h:outputLabel>
        </h:column>
</t:dataTable>

<t:dataScroller id="dataScrollerId" for="tableid" fastStep="10"
        pageIndexVar="pageIndex" renderFacetsIfSinglePage="true"
        pageCountVar="pageCount" paginator="true" paginatorMaxPages="9"
        immediate="true">
        <f:facet name="first">
            <t:outputText value="First"></t:outputText>
        </f:facet>
        <f:facet name="last">
            <t:outputText value="Last"></t:outputText>
        </f:facet>
        <f:facet name="previous">
            <t:outputText value="Previous"></t:outputText>
        </f:facet>
        <f:facet name="next">
            <t:outputText value="Next"></t:outputText>
        </f:facet>
</t:dataScroller>    

I am trying to implement Pagination in JSF using Tomahawk. When the page is loaded, the table in the first page is populated with data. But, when I click on Next or Prev the table is empty. I don't see any javascript error in the browser. Following is the code from the jsp. Please let me know if I am missing something:

<t:dataTable id="tableid" value="#{SiteSearchCriteria.siteList}"
        var="item" border="1" rows="5" rowIndexVar="rowIndex"
        rowClasses="trobg1,trobg2">
        <h:column>
            <f:facet name="header">
                <h:outputText value="siteName"></h:outputText>
            </f:facet>
            <h:outputLabel value="#{item.siteName}"></h:outputLabel>
        </h:column>

        <h:column>
            <f:facet name="header">
                <h:outputText value="siteCLLI"></h:outputText>
            </f:facet>
            <h:outputLabel value="#{item.siteCLLI}"></h:outputLabel>
        </h:column>
</t:dataTable>

<t:dataScroller id="dataScrollerId" for="tableid" fastStep="10"
        pageIndexVar="pageIndex" renderFacetsIfSinglePage="true"
        pageCountVar="pageCount" paginator="true" paginatorMaxPages="9"
        immediate="true">
        <f:facet name="first">
            <t:outputText value="First"></t:outputText>
        </f:facet>
        <f:facet name="last">
            <t:outputText value="Last"></t:outputText>
        </f:facet>
        <f:facet name="previous">
            <t:outputText value="Previous"></t:outputText>
        </f:facet>
        <f:facet name="next">
            <t:outputText value="Next"></t:outputText>
        </f:facet>
</t:dataScroller>    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷情妓 2024-10-15 15:05:45

我使用的支持 bean 位于“请求”范围内。因此,当我单击“下一步”时,数据不可见。将支持 bean 的范围更改为“Session”,事情开始工作。

The backing bean that I was using was in "request" scope. Hence, the data was not visible when I clicked on "Next". Changed the scope of backing bean to "Session" and things started to work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文