I started testing the system today with the latest version of demoiselle (2.5), but paging is no longer working.
When you enter the page the content is listed, but when you change pages, nothing else appears.
Previously I was using version 2.4.2.
It is worth mentioning that I also updated for PrimeFaces 5.2, but when I identified the error I went back to the version 5.0 of PrimeFaces that worked previously, but even then the pagination did not work anymore.
Aguem is going through this and knows how to solve?
Code sample:
private LazyDataModel<Cliente> dataModel;
@Override
public LazyDataModel<Cliente> getDataModel() {
if (dataModel == null) {
dataModel = new LazyDataModel<Cliente>() {
@Override
public List<Cliente> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
Pagination pagination = getPagination();
pagination.setPageSize(pageSize);
pagination.setFirstResult(first);
List<Cliente> itemsList = handleResultList();
dataModel.setRowCount(pagination.getTotalResults());
return itemsList;
}
};
}
return dataModel;
}
@Override
protected List<Cliente> handleResultList() {
if(search.isAll()){
return this.clienteBC.findFastByExample(null);
}
Cliente bean = new Cliente();
bean.setParticipante(search.getBean());
return this.clienteBC.findFastByExample(bean);
}
My xhtml looks like this:
<p:dataTable id="list" var="bean" value="#{clienteListMB.dataModel}" lazy="true" paginator="true"
first="${messages['page.first']}" rows="${messages['page.rows']}"
pageLinks="${messages['page.max.links']}">
<p:column style="width: 8%; text-align: left;" sortBy="#{bean.id}">
<f:facet name="header">${messages['participante.label.id']}</f:facet>
<h:commandLink action="#{clienteListMB.getNextView}" actionListener="#{clienteListMB.clear}">
<h:outputText value="#{bean.id}" />
<f:param name="cli_id" value="#{bean.id}" />
<f:param name="part_id" value="#{bean.participante.id}" />
<f:param name="tipo_cad" value="#{2}" />
</h:commandLink>
</p:column>
<p:column style="width: 15%; text-align: left;" sortBy="#{bean.participante.codigo}">
<f:facet name="header">${messages['participante.label.codigo']}</f:facet>
<h:commandLink action="#{clienteListMB.getNextView}" actionListener="#{clienteListMB.clear}">
<h:outputText value="#{bean.participante.codigo}" />
<f:param name="cli_id" value="#{bean.id}" />
<f:param name="part_id" value="#{bean.participante.id}" />
<f:param name="tipo_cad" value="#{2}" />
</h:commandLink>
</p:column>
<p:column style="width: 50%; text-align: left;" sortBy="#{bean.participante.nome}">
<f:facet name="header">${messages['participante.label.nome']}</f:facet>
<h:commandLink action="#{clienteListMB.getNextView}" actionListener="#{clienteListMB.clear}">
<h:outputText value="#{bean.participante.nome}" />
<f:param name="cli_id" value="#{bean.id}" />
<f:param name="part_id" value="#{bean.participante.id}" />
<f:param name="tipo_cad" value="#{2}" />
</h:commandLink>
</p:column>
<p:column style="width: 15%; text-align: left;">
<f:facet name="header">${messages['participante.label.doc']}</f:facet>
<h:commandLink action="#{clienteListMB.getNextView}" actionListener="#{clienteListMB.clear}">
<!--NOVO METODO DE MOSTRAR O DOCUMENTO OU O ID ESTRANGEIRO, DESSA
FORMA DISPENSA O USO DE UM OUTPUTTEXT COM REDERED-->
<h:outputText value="#{bean.participante.documento}#{bean.participante.idEstrangeiro}" />
<f:param name="cli_id" value="#{bean.id}" />
<f:param name="part_id" value="#{bean.participante.id}" />
<f:param name="tipo_cad" value="#{2}" />
</h:commandLink>
</p:column>
<p:column style="width: 15%; text-align: left;" sortBy="#{bean.participante.fone}">
<f:facet name="header">${messages['participante.label.fone']}</f:facet>
<h:commandLink action="#{clienteListMB.getNextView}" actionListener="#{clienteListMB.clear}">
<h:outputText value="#{bean.participante.fone}" />
<f:param name="cli_id" value="#{bean.id}" />
<f:param name="part_id" value="#{bean.participante.id}" />
<f:param name="tipo_cad" value="#{2}" />
</h:commandLink>
</p:column>
<p:column style="width:10%; text-align: center;">
<f:facet name="header">${messages['label.actions']}</f:facet>
<div class="btn-group btn-group-xs" role="group">
<h:commandLink action="#{clienteListMB.getNextView}" actionListener="#{clienteListMB.clear}" title="${messages['button.edit']}" class="btn btn-white">
<span class="glyphicon glyphicon-edit"/>
<f:param name="cli_id" value="#{bean.id}" />
<f:param name="part_id" value="#{bean.participante.id}" />
<f:param name="tipo_cad" value="#{2}" />
</h:commandLink>
</div>
</p:column>
</p:dataTable>