Primefaces datatable sortby does not work

Asked

Viewed 168 times

1

Good morning, you guys. I am new to the forum and I would like your help in the following situation. My datatable sortBy is not working properly. The datatable simply loses its table format and displays the inline content. On some pages it appears normal, but on others it loses configuration.

I’m using the 5.3 primefaces. I appreciate all your cooperation

xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
template="/template/template/template.xhtml">

<ui:define name="conteudo" >       
    <h:form id="formGeral">
        <p:panel id="parlamentares" header="Parlamentares" class="panel-height-front panel-border-color">
            <p:outputPanel autoUpdate="true" class="ui-fluid">
                <p:panelGrid id="panelPeriodo" columns="1" layout="grid" columnClasses="ui-grid-col-12" class="panelgrid-noborder">
                    <p:outputLabel value="Período de Legislatura"/>
                    <p:selectOneMenu value="#{cidadaoParlamentaresBean.periodoSelecionado}" class="panelgrid-item-width-min20max40">  
                        <f:selectItem itemLabel="Selecione" itemValue=""/>
                        <f:selectItems itemLabel="#{per.periodoNome}" itemValue="#{per.periodoNome}" value="#{cidadaoParlamentaresBean.periodos}" var="per"/>
                        <p:ajax event="change" listener="#{cidadaoParlamentaresBean.consultarParlamentarPorPeriodo()}" update="dtParlamentares"/>
                    </p:selectOneMenu>
                </p:panelGrid>
            </p:outputPanel>

            <p:dataTable id="dtParlamentares" value="#{cidadaoParlamentaresBean.membros}" var="parlamentar"  rowStyleClass="#{cont %2!=0 ? 'old' : null}" 
                         rowIndexVar="cont" styleClass="background_datatable"
                         emptyMessage="Não Há Parlamentares Cadastrados" scrollRows="50"  scrollable="true" scrollHeight="400" sortBy="#{parlamentar.membrosUserCodigo.userNomeusuario}" 
                         selection="#{cidadaoParlamentaresBean.membroSelecionado}" rowKey="#{parlamentar.membrosCodigo}"
                         paginator="true" paginatorPosition="top" paginatorTemplate="{Exporters}"
                         reflow="true" class="margin-top background_datatable">

                <f:facet name="{Exporters}">
                    <nav class="export-icons-nav">
                        <h:commandLink styleClass="export-icons-commandLink">
                            <p:graphicImage library="img" title="xls" name="exp_xls.png" styleClass="export-icons-img"/>
                            <p:dataExporter type="xls" target="dtParlamentares" fileName="parlamentares" pageOnly="true"/>
                        </h:commandLink>

                        <h:commandLink styleClass="export-icons-commandLink">
                            <p:graphicImage library="img" title="pdf" name="exp_pdf.png" styleClass="export-icons-img"/>
                            <p:dataExporter type="pdf" target="dtParlamentares" fileName="parlamentares" pageOnly="false"/>
                        </h:commandLink>

                        <h:commandLink styleClass="export-icons-commandLink">
                            <p:graphicImage library="img" title="csv" name="exp_csv.png" styleClass="export-icons-img"/>
                            <p:dataExporter type="csv" target="dtParlamentares" fileName="parlamentares"  />
                        </h:commandLink>

                        <h:commandLink styleClass="export-icons-commandLink">
                            <p:graphicImage library="img" title="xml" name="exp_xml.png" styleClass="export-icons-img"/>
                            <p:dataExporter type="xml" target="dtParlamentares" fileName="parlamentares"  />
                        </h:commandLink>
                    </nav>
                    <div style="clear: both"></div>
                </f:facet>

                <p:column headerText="Nome" sortBy="#{parlamentar.membrosUserCodigo.userNomeusuario}" >
                    <p:commandLink action="#{cidadaoParlamentaresBean.carregarDialogCuriculo()}" value="#{parlamentar.membrosUserCodigo.userNomeusuario}">
                        <f:setPropertyActionListener value="#{parlamentar}" target="#{cidadaoParlamentaresBean.membroSelecionado}"/>
                    </p:commandLink>
                </p:column>

                <p:column headerText="Apelido" sortBy="#{parlamentar.membrosUserCodigo.userApelido}">
                    <p:outputLabel value="#{parlamentar.membrosUserCodigo.userApelido}"/>
                </p:column>

                <p:column headerText="Email" sortBy="#{parlamentar.membrosUserCodigo.userEmail}">
                    <p:outputLabel value="#{parlamentar.membrosUserCodigo.userEmail}"/>
                </p:column>
            </p:dataTable>

        </p:panel>
    </h:form>

    <p:dialog id="dlgCurriculo" header="Currículo Parlamentar" widgetVar="widCurriculo"  appendTo="@(BODY)" resizable="false" modal="true" closeOnEscape="true" dynamic="true"
              visible="#{cidadaoParlamentaresBean.abrirCurriculo}" class="dialog-width"  >
        <h:form id="formDialog">

            <ui:include src="/telas/cidadao/CurriculoParlamentar.xhtml"/>

        </h:form>
    </p:dialog>

</ui:define>

No answers

Browser other questions tagged

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