title: Primefaces datatable sort has strange behavior after filtering the table
body: <p>We use primeface 5.1, JSF 2.2 for our project. 
  I have a problem in the primefaces datatable, after filtering the datatable, the sort will be broken, no record will show in the datatable if trying to sort the table. The following is the jsf code and the issue snapshot. </p>
  
  <pre><code>&lt;p:dataTable id="myTable" var="model" value="#{myBean.dynaModels}" widgetVar="tableWidget" editable="true" styleClass="ui-dyna-table" 
           rows="10" paginator="true" resizableColumns="true" tableStyle="width:auto" filterEvent="enter" emptyMessage="No service order found"
           paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {CurrentPageReport}" draggableColumns="true"
           currentPageReportTemplate="{startRecord} - {endRecord} of {totalRecords}" paginatorPosition="top" rowsPerPageTemplate="10,20,50,100" style="margin-right: 5px"&gt; 
  &lt;f:facet name="header"&gt;
      &lt;p:commandButton id="toggler" type="button" value="Columns" style="float:right" icon="ui-icon-calculator" /&gt;
      &lt;p:columnToggler datasource="myTable" trigger="toggler" /&gt;
  &lt;/f:facet&gt;
  &lt;c:forEach items="#{myBean.columnProperties}" var="columnProperty" &gt;
      &lt;p:column headerText="#{columnProperty.descr}" rendered="#{columnProperty.componentType.value eq 'S1'}" filterBy="#{model.dyanModelMap[columnProperty.propertyKey].value}" 
                sortBy="#{model.dyanModelMap[columnProperty.propertyKey].value}" filterMatchMode="exact"&gt;
          &lt;f:facet name="filter" &gt;
              &lt;p:selectOneMenu style="width:111px" onchange="PF('tableWidget').filter()" &gt;
                  &lt;f:selectItem itemValue="" noSelectionOption="true"/&gt;
                  &lt;f:selectItems value="#{columnProperty.lov}" /&gt;
              &lt;/p:selectOneMenu&gt;
          &lt;/f:facet&gt;
          &lt;h:outputText value="#{model.dyanModelMap[columnProperty.propertyKey].value}"  /&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="#{columnProperty.descr}" rendered="#{columnProperty.componentType.value eq 'TXT'}" filterBy="#{model.dyanModelMap[columnProperty.propertyKey].value}" 
                sortBy="#{model.dyanModelMap[columnProperty.propertyKey].value}" filterMatchMode="contains"&gt;  
          &lt;h:outputText value="#{model.dyanModelMap[columnProperty.propertyKey].value}"  /&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="#{columnProperty.descr}" rendered="#{columnProperty.componentType.value eq 'DT'}" filterBy="#{model.dyanModelMap[columnProperty.propertyKey].value}" sortBy="#{model.dyanModelMap[columnProperty.propertyKey].value}"&gt;
          &lt;f:facet name="filter" &gt;
              &lt;p:calendar  showOn="button" onchange="PF('tableWidget').filter()" &gt;
              &lt;/p:calendar&gt;
          &lt;/f:facet&gt;
          &lt;h:outputText value="#{model.dyanModelMap[columnProperty.propertyKey].value}"  /&gt;
      &lt;/p:column&gt;
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p></p>
  
  <p><img src="https://i.stack.imgur.com/XPnFd.png" alt="Snapshot for the issue"></p>