jeudi 5 mars 2020

Datatable pagination page button not working when I put datatable inside the tag tab

I have a application using JSF 2.0. I'm displaying values in Primefaces 5.3 datatable and the problem is when I clik the pagination. Example: If I have 10 rows and each page set to display 5 rows, then there will be 2 buttons labeled 1-2 at the bottom of the datatable. If I click 2 nothing happens. It just shows first 5 recrods only. This is happend when I put the datatable inside the tag tab, but if I put the datatable outside of it, the datatable pagination page button works perfectly.

<p:tabView>
    <p:tab title="Cabang">
        <f:facet name="title">
            <p:graphicImage name="cabang.png" library="images" width="25px" height="25px"/>
            <h:outputText value="Cabang" style="margin-left:5px;" />
        </f:facet>
        <h:form>
            <div class="row">
                <div class="col s1">
                    <p:outputLabel value="Cabang :" style="color: black;"/>
                    <p:selectManyMenu id="cabang" var="t"
                        filter="true" filterMatchMode="contains" showCheckbox="true">
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                    </p:selectManyMenu>
                </div>
                <div class="col s1">
                    <p:commandButton value="Add" style="margin-top: 30px; margin-left:60px;
                        background-color: #26a69a;"/>
                </div>
                <div class="col s1"></div>
                <div class="col s1">
                    <p:outputLabel value="Produk :" style="color: black;"/>
                    <p:selectManyMenu id="produk" var="t"
                        filter="true" filterMatchMode="contains" showCheckbox="true">
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                    </p:selectManyMenu>
                </div>
                <div class="col s1">
                    <p:commandButton value="Add" style="margin-top: 30px; margin-left:60px;
                        background-color: #26a69a;"/>
                </div>
                <div class="col s1"></div>
                <div class="col s3">
                    <p style="color: black;">Keterangan: <br/>
                        Memilih cabang berarti semua toko pada cabang tersebut akan diproses. 
                    </p>
                    <div class="row">
                        <h6 style="color: black;">Data Yang Dipilih :</h6>
                        <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="pilCab"
                                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
                                <p:columnGroup type="header">
                                    <p:column headerText="Cabang" />
                                </p:columnGroup>


                                <p:column>
                                    <h:outputText value="#{pilihCabang.nama}"/>
                                </p:column>
                            </p:dataTable>
                        </h:form>
                    </div>
                </div>
                <div class="col s3">
                    <div class="row">
                        <h:form id="dataTableDua">
                            <p:dataTable var="pilihProduk" rows="5"
                                style="width: 100%; float: left; margin-top: 113px; margin-left: 10px;" 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 />
                                </p:column>
                            </p:dataTable>
                        </h:form>
                    </div>
                </div>
            </div>
        </h:form>
        <div class="row">
            <p:commandButton value="Proses" style="margin-top: 10px; padding: 0px 50px; 
                background-color: #26a69a;" action="analysis-result-cabang?faces-redirect=true"/>
        </div>
    </p:tab>
    <p:tab title="Toko">
        <f:facet name="title">
            <p:graphicImage name="toko.png" library="images" width="25px" height="25px"/>
            <h:outputText value="Toko" style="margin-left:5px;" />
        </f:facet>
        <h:form>
            <div class="row">
                <div class="col s1">
                    <p:outputLabel value="Toko :" style="color: black;"/>
                    <p:selectManyMenu id="toko" var="t"
                        filter="true" filterMatchMode="contains" showCheckbox="true">
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                    </p:selectManyMenu>
                </div>
                <div class="col s1">
                    <p:commandButton value="Add" style="margin-top: 30px; margin-left:60px;
                        background-color: #26a69a;"/>
                </div>
                <div class="col s1">
                </div>
                <div class="col s1">
                    <p:outputLabel value="Produk :" style="color: black;"/>
                    <p:selectManyMenu id="produk" var="t"
                        filter="true" filterMatchMode="contains" showCheckbox="true">
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                        <f:selectItem itemLabel="a" itemValue="a" />
                    </p:selectManyMenu>
                </div>
                <div class="col s1">
                    <p:commandButton value="Add" style="margin-top: 30px; margin-left:60px;
                        background-color: #26a69a;"/>
                </div>
                <div class="col s1"></div>
                <div class="col s3">
                    <p style="color: black;">Keterangan: <br/>
                        Memilih toko berarti tidak memperdulikan cabang toko tersebut. 
                    </p>
                    <div class="row">
                        <h6 style="color: black;">Data Yang Dipilih :</h6>
                        <h:form id="dataTable">
                            <p:dataTable var="productMovementAnalysis" rows="5"
                                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="pma"
                                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
                                <p:columnGroup type="header">
                                    <p:column headerText="Toko" />
                                </p:columnGroup>


                                <p:column>
                                    <h:outputText />
                                </p:column>
                            </p:dataTable>
                        </h:form>
                    </div>
                </div>
                <div class="col s3">
                    <div class="row">
                        <h:form id="dataTableDua">
                            <p:dataTable var="pilihProduk" rows="5"
                                style="width: 100%; float: left; margin-top: 113px; margin-left: 10px;" 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 />
                                </p:column>
                            </p:dataTable>
                        </h:form>
                    </div>
                </div>
            </div>
        </h:form>
        <div class="row">
            <p:commandButton value="Proses" style="margin-top: 10px; padding: 0px 50px; 
                background-color: #26a69a;" action="analysis-result-toko?faces-redirect=true"/>
        </div>
    </p:tab>
</p:tabView>



Aucun commentaire:

Enregistrer un commentaire