2
votes

I have created a datatable by using primefaces. It contains options filtering, sorting and pagination. Before filtering table, pagination works correctly. But when some data is filtered, pagination doesn't work. That means page numbers are not rendered. Before I have created datatable in my another application in the same way. It works correctly. I tried LazyDataModel of primefaces in my code also. but it also didn't work. I can't figure out what is the error in my code.

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:p="http://primefaces.org/ui"
            xmlns:f="http://java.sun.com/jsf/core"
            template="home.xhtml">
<ui:define name="content">
    <p:tabView style="font-size: 12px" id="numberAnalyzerTab">
        <p:tab title="Number Analyzer">
            <h:form id="form">
                <p:messages id="msgs" showDetail="true" autoUpdate="true" closable="true"/>
                <p:dataTable id="dataTable"
                             var="addressEvent"
                             value="#{addressTableBean.addressUnits}"
                             rowKey="#{addressEvent.id}"
                             rows="10"
                             selectionMode="single"
                             paginator="true" filteredValue="#{addressTableBean.filteredAddressUnits}"
                             editable="true">

                    <f:facet name="header">
                        <h:outputText value="List of Addresses"/>
                    </f:facet>

                    <p:column headerText="Prefix" sortBy="#{addressEvent.numberPrefix}" filterBy="#{addressEvent.numberPrefix}" id="prifix">
                         #{addressEvent.numberPrefix}
                    </p:column>

                </p:dataTable>
            </h:form>
        </p:tab>
    </p:tabView>
</ui:define>

1

1 Answers

0
votes

Try adding paginatorTemplate to p:datatable and make sure not to modify

addressTableBean.filteredAddressUnits 

in your bean, not even using new operator

paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"

rowsPerPageTemplate="20,50,100" //Your values here