简体   繁体   English

两个分页不能在一页中独立工作 - JSF、Primefaces

[英]Two paginations not working independently in one page - JSF, Primefaces

I have one web page where there is 2 tables with paginations in each tables.我有一个网页,其中有 2 个表格,每个表格中都有分页。 It makes a problem when I click the pagination.单击分页时会出现问题。 For ex., If I select second page of second table then first table automatically changed with 2nd page.例如,如果我选择第二个表的第二页,那么第一个表会自动更改为第二页。 Do you guys have any suggestion?大家有什么建议吗? So, here is my code:所以,这是我的代码:

<div class="col s6">
                <div class="row">
                    <h:form id="dataTable">
                        <p:dataTable var="pilihCabang" rows="5"
                            value="#{cabangView.cabangs}"
                            style="width: 100%; float: left; margin-top: 0px;"
                            paginator="true" pageLinks="5" rowsPerPageTemplate="5,10,15"
                            widgetVar="widgetWorkOrder" rowIndexVar="rowIndex"
                            paginatorPosition="bottom" emptyMessage="No record found"
                            styleClass="no-dtbl-header" id="pilToko"
                            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
                            <p:columnGroup type="header">
                                <p:column headerText="Toko" />
                            </p:columnGroup>
                            <p:column>
                                <h:outputText value="#{pilihCabang.nama}" />
                                <p:commandLink style="float:right">
                                    <p:graphicImage name="delete.png" library="images" width="25px" height="25px"/>
                                </p:commandLink>
                            </p:column>
                        </p:dataTable>
                    </h:form>
                </div>
            </div>
            <div class="col s6">
                <div class="row">
                    <h:form id="dataTabledua">
                        <p:dataTable var="pilihProduk" rows="5"
                            value="#{produkView.produks}"
                            style="width: 100%; float: left; margin-top: 0px;"
                            paginator="true" pageLinks="5" rowsPerPageTemplate="5,10,15"
                            widgetVar="widgetWorkOrder" rowIndexVar="rowIndex"
                            paginatorPosition="bottom" emptyMessage="No record found"
                            styleClass="no-dtbl-header" id="pilPro"
                            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
                            <p:columnGroup type="header">
                                <p:column headerText="Produk" />
                            </p:columnGroup>
                            <p:column>
                                <h:outputText value="#{pilihProduk.nama}" />
                                <p:commandLink style="float:right">
                                    <p:graphicImage name="delete.png" library="images" width="25px" height="25px"/>
                                </p:commandLink>
                            </p:column>
                        </p:dataTable>
                    </h:form>
                </div>
            </div>

This is caused by both datatables having the same widgetVar.这是由具有相同 widgetVar 的两个数据表引起的。 Change one and you will be fine.换一个,你会没事的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM