Paging using Demoiselle 2.5.0

Asked

Viewed 224 times

0

I started testing the system today with the most current version of Démoiselle (2.5), however, paging is no longer working.

When entering the page the content is listed, but by the time you change the page, nothing else appears.

Previously I was using version 2.4.2.

It is worth mentioning that I also updated for Primefaces 5.2, however, when I identified the error I went back to version 5.0 of the Primefaces that worked previously, but even so did not work anymore paging.

Hang on, you’re going through this and you know how to fix it?

Code example:

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 is as follows:

   <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>

1 answer

1


It was found a defect in this functionality, until version 2.4.2 the implementation of the Paginationcontext class had session scope and changed to request but this is generating this problem.

Thank you if you can log this into our Bugtrack system (http://tracker.frameworkdemoiselle.gov.br)

  • Right. I will register yes! Thank you for the reply!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.