Column sortby with pagination and not lazyload

UI Components for JSF
Post Reply
emmanuelmf
Posts: 1
Joined: 07 May 2021, 19:28

07 May 2021, 19:39

Hello, I'm new in this forum, using Primefaces 10.0.0, java 11, springboot 5.

i have a data table like this:

Code: Select all

 <p:dataTable id="testDT" var="test" value="#{dtViewDashboard.testList}"
                         selection="#{dtViewDashboard.facturasCorreos}" rowKey="#{empresa.id}" selectionPageOnly="false"
                         widgetVar="testTable" paginator="true" rows="20" rendered="#{dtViewDashboard.show}"
                         emptyMessage="#{msgGlobal['message.facturasVacias']}" filteredValue="#{dtViewDashboard.testListF}"
                         showGridlines="true"
                         paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         currentPageReportTemplate="{startRecord}-{endRecord} de {totalRecords} facturas"
                         rowsPerPageTemplate="5,10,20,{ShowAll|'All'}"
                         reflow="true"  stripedRows="true" draggableColumns="true" tableStyle="table-layout:auto" editMode="cell" editable="true"
                         sortMode="multiple"
                         stickyHeader="false" stickyTopAt=".layout-topbar" > 
                         
                         <f:facet name="header">
                    <div class="p-d-flex p-ai-center p-jc-between">
                        <span>#{msgGlobal['span.testDashboard']}</span>
                        <p:inputText id="globalFilter" onkeyup="PF('testTable').filter()" style="width:10rem;margin-left: 16px" placeholder="#{msgGlobal['placeholder.test']}" />
                        <p:selectOneMenu  value="#{dtViewDashboard.estadoSelect}" style="margin-left: 16px; vertical-align: middle">
                            <f:selectItems value="#{dtViewDashboard.estados}" />
                            <p:ajax event="change" listener="#{dtViewDashboard.consultaTest}" update="form1 form form2" />
                        </p:selectOneMenu>
                        <p:commandButton id="toggler" type="button" value="#{msgGlobal['boton.seleccionarColumnas']}" style="float:right" icon="pi pi-ellipsis-v"/>
                        <p:columnToggler datasource="empresasDT" trigger="toggler"/>
                    </div>
                </f:facet>
                <p:ajax event="rowSelectCheckbox" update="form" />
                <p:ajax event="rowUnselectCheckbox" update="form" />
                <p:ajax event="rowSelect" update="form" />
                <p:ajax event="rowUnselect" update="form" />


                <p:column headerText="#{msgGlobal['header.test']}" sortBy="#{test.name}" filterBy="#{test.name}" style="text-align: center">
                    <h:outputText value="#{test.name}" />
                </p:column>
I've tried with lazy loading, without lazy loading and the resutl is the same, my data table is not being sorted.

here is my bean init method:

Code: Select all

@PostConstruct
    public void init(){
       testList=service.getTest();
    }
service.getTest returns a list of 1519 elements being paginated on the data table.

Melloware
Posts: 2647
Joined: 22 Apr 2013, 15:48

09 May 2021, 15:10

Are you using client state saving by any chance? And could your issue be this:

Code: Select all

https://github.com/primefaces/primefaces/issues/6987
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 10.0.2 / PF Extensions 10.0.2

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 44 guests