2
votes

I am using JSF 2.0 with with PrimeFaces 5.2 in my Web Application. On a page there is a Datatable wich shows Tickets stored in Database in paginated form. Normally pagination is working fine but when I filter the Tickets using filterBy, it returns 4 pages, in which first page shows correctly filtered Ticktes, as soon as I click on page 2 or any page number greater than 1, the Datatable does not show filtered results rather it shows the unfiltered tickets of respective page as if no filter was applied, I want filtered results on other pages also .

More precisely I want that when I click on a page number greater than 1 , Datatable fetch respective page from the set of filtered tickets not form the set of all the Tickets. How can I do this?

I have gone through PrimeFaces 5.2' User-Guide , and read the attributes of the Datatable and tried a few which seemed helpful but problem still remains.

here is my Datatable,

<p:dataTable id="tickets" var="ticket"
                value="#{ticketBean.ticketModels}" paginator="true" rows="10"
                filteredValue="#{ticketBean.filteredTickets}">



                <p:column headerText="Summary" style="width:300px;">
                    <h:outputText value="#{ticket.summary}" />
                </p:column>



                <p:column headerText="Status" filterBy="#{ticket.status}"
                    filterOptions="#{ticketBean.statusFilterList}"
                    filterMatchMode="exact" style="width:110px;">
                    <h:outputText value="#{ticket.status}" />
                </p:column>

                <p:column headerText="Assigned To" filterBy="#{ticket.assignedTo}"
                    filterOptions="#{ticketBean.userFilterList}" filterMatchMode="exact"
                    style="width:110px;">
                    <h:outputText value="#{ticket.assignedTo}" />
                </p:column>
    ....................................
            </p:dataTable>
1
Show some code please. Look here on how to create an mcveKukeltje

1 Answers

-1
votes

Just add the below line to your p:datatable and check the same

paginator="true" rows="10" 
paginatorTemplate="{CurrentPageReport}  {FirstPageLink} 
{PreviousPageLink} {PageLinks}
{NextPageLink} {LastPageLink} {RowsPerPageDropdown} " 
rowsPerPageTemplate="10,15,20"