1
votes

I am using a complex datatable that can sort and filter with various filter. my problem is as I try to use column filter, global filter or sorting datatable pagination suddenly drops to 1 page and it doesn't turn back to first state with pagination. At the beginning I have 92 pages but after filtering/sorting it becomes a datatable with 1 page, even though I clear the textbox of filter it stays as 1 page.

Here is my datatable:

<h:panelGroup rendered="#{projectsController.items.rowCount > 0}">
<p:growl id="growl" />  
<p:dataTable id="datatable" value="#{projectsController.items}" var="item" filterEvent="keyup" 
             paginator="true" rows="5" emptyMessage="Proje bulunamadı." paginatorPosition="bottom"  
             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
             rowsPerPageTemplate="4,5,6,7,8,9,10" 
             filteredValue="#{projectsController.filteredProjects}" style="font-size:11px;font-weight: bold;"  widgetVar="proj" >

    <f:facet name="header">  
       <p:outputPanel>  
          <h:outputText value="Tüm Alanlarda Ara:  " />  
          <p:inputText id="globalFilter" onkeyup="proj.filter();" style="width:150px" />  
       </p:outputPanel>  
    </f:facet> 


    <p:column id="c1" headerText="Proje Adı" width="500" filterStyle="display:none" styleClass="wrap" sortBy="#{item.projectname}" filterBy="#{item.projectname}" filterMatchMode="contains" >
       <h:outputText value="#{item.projectname}"/>
    </p:column>

    <p:column headerText="İlçe" width="150" styleClass="wrap" filterStyle="display:none" filterBy="#{item.district}" sortBy="#{item.district}" filterOptions="#{populator.districtsDD}" filterMatchMode="exact">
        <h:outputText value="#{item.district}"/>
    </p:column>

    <p:column headerText="Sektör" width="150" styleClass="wrap" filterStyle="display:none" filterBy="#{item.sector}" sortBy="#{item.sector}" filterOptions="#{populator.sectorsDD}" filterMatchMode="exact">
        <h:outputText value="#{item.sector}"/>
    </p:column>

    <p:column headerText="Başlangıç Tarihi" width="150" styleClass="wrap" filterStyle="display:none" sortBy="#{item.startdate}" filterBy="#{item.startdate}" filterMatchMode="contains">
        <h:outputText value="#{item.startdate}"/>
    </p:column>

    <p:column headerText="Bitiş Tarihi" width="150" styleClass="wrap" filterStyle="display:none" sortBy="#{item.enddate}" filterBy="#{item.enddate}" filterMatchMode="contains">
        <h:outputText value="#{item.enddate}"/>
    </p:column>

    <p:column headerText="İş Durumu" width="150" styleClass="wrap" filterStyle="display:none" sortBy="#{item.workstatus}" filterBy="#{item.workstatus}" filterMatchMode="contains">
        <h:outputText value="#{item.workstatus}"/>
    </p:column>

    <p:column>
        <p:commandButton id="selectButton" update=":display" oncomplete="carDialog.show()" icon="ui-icon-search" title="Detayları Gör">  
           <f:setPropertyActionListener value="#{item}" target="#{projectsController.selectedP}" />
           <p:ajax event="click" update=":viewTabs:tabView:mapTab"/>
        </p:commandButton>
        <p:commandButton id="editButton" update=":displayEdit" oncomplete="editDialog.show()" icon="ui-icon-pencil" title="Düzenle">  
           <f:setPropertyActionListener value="#{item}" target="#{projectsController.selectedP}" />
         </p:commandButton>
         <p:commandButton update="growl" title="Projeyi Sil" id="confirm" action="#{projectsController.destroy}" icon="ui-icon-trash" ajax="false" onclick="if (!confirm('Bu projeyi gerçekten silmek istiyor musunuz?'))
                                            return false;"/>  
      </p:column>
</p:dataTable>

After filtering or sorting how can I reset my datatable to first state? Thanks in advance.

Primefaces 3.5, Oracle WebLogic 10g, JSF 2.2

Here is the snapshot:

![enter image description here][1]

1

1 Answers

1
votes

For those who want to know solution, I have removed both jsf-api.jar and jsf-impl.jar from the libraries instead I have put netbeans' own jsf2.1 library. Basically I have downgraded to jsf2.1. I just suspect if jsf-api and jsf-impl gives me the support of jsf2.2.

Hope this helps to someone.