title: Sorting is not working in datatable in PrimeFaces?
body: <p>Sorting is not working in datatable in PrimeFaces. Please suggest.</p>
  
  <p>See below my .xhtml file</p>
  
  <pre><code>&lt;h:form&gt;
  
    &lt;p:dataTable style="width: 60%" id="dt1" value="#{bean.list}" var="entry" first="0" paginator="true" rows="10" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15" emptyMessage="No cars found with given criteria" &gt;
  
      &lt;f:facet name="header"&gt;
        &lt;h2&gt;Cars View&lt;/h2&gt;
      &lt;/f:facet&gt;
  
      &lt;p:column sortBy="#{entry.carno}" filterBy="#{entry.carno}"&gt;
        &lt;f:facet name="header"&gt;
          &lt;h:outputText value="Car Number" /&gt;
        &lt;/f:facet&gt;
        &lt;h:outputText value="#{entry.carno}"&gt;&lt;/h:outputText&gt;
      &lt;/p:column&gt;
  
      &lt;p:column sortBy="#{entry.carsettings['car-model']}" filterBy="#{entry.carsettings['car-model']}"&gt;
        &lt;f:facet name="header"&gt;
          &lt;h:outputText value="Car Model"/&gt;
        &lt;/f:facet&gt;
        &lt;h:outputText value="#{entry.carsettings['car-model']}"&gt;&lt;/h:outputText&gt;
      &lt;/p:column&gt;
  
      &lt;p:column sortBy="#{entry.carsettings.year}" filterBy="#{entry.carsettings.year}"&gt;
        &lt;f:facet name="header"&gt;
          &lt;h:outputText value="Car Year"/&gt;
        &lt;/f:facet&gt;
        &lt;h:outputText value="#{entry.carsettings.year}"&gt;&lt;/h:outputText&gt;
      &lt;/p:column&gt;
  
      &lt;p:column sortBy="#{entry.carsettings.color}" filterBy="#{entry.carsettings.color}"&gt;
        &lt;f:facet name="header"&gt;
          &lt;h:outputText value="Car Color"/&gt;
        &lt;/f:facet&gt;
        &lt;h:outputText value="#{entry.carsettings.color}"&gt;&lt;/h:outputText&gt;
      &lt;/p:column&gt;
    &lt;/p:dataTable&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <hr>
  
  <p>@Sean</p>
  
  <p>Look below code</p>
  
  <p>
  
      
          List of Cars
          
      
      </p>
  
  <pre><code>    &lt;ui:composition template="/template.xhtml"&gt;
          &lt;ui:define name="content"&gt;
              &lt;f:view&gt;
                  &lt;f:event type="preRenderView" listener="#{MyBackingBean.load}"&gt;&lt;/f:event&gt;
                  &lt;center&gt;
                      &lt;h1&gt;Car View&lt;/h1&gt;
                      &lt;h:outputText value="No data found" style="font-size: 15px;font-family: Arial, Verdana,Helvetica, sans-serif" rendered="#{MyBackingBean.noDataExist}"&gt;&lt;/h:outputText&gt;
                      &lt;h:form id="dataform1"&gt;
                          &lt;p:dataTable var="item" value="#{MyBackingBean.dataList}" dynamic="true" paginator="true" rows="2" id="table"  style="width:60%"
                                       rendered="#{!MyBackingBean.noDataExist}" &gt;
                              &lt;p:column sortBy="#{item.id}" filterBy="#{item.id}"&gt;
                                  &lt;f:facet name="header"&gt;
                                      &lt;h:outputText value="ID" /&gt;
                                  &lt;/f:facet&gt;
                                  &lt;h:outputText value="#{item.id}" /&gt;
                              &lt;/p:column&gt;
                              &lt;p:column sortBy="#{item.carsettings['car-color']}" filterBy="#{item.carsettings['car-color']}"&gt;
                                  &lt;f:facet name="header"&gt;
                                      &lt;h:outputText value="Color" /&gt;
                                  &lt;/f:facet&gt;
                                  &lt;h:outputLink target="_blank" value="http://#{item.carsettings['car-color']}"&gt;
                                      &lt;h:outputText value="#{item.carsettings['car-color']}" /&gt;
                                  &lt;/h:outputLink&gt;
                              &lt;/p:column&gt;
                              &lt;p:column sortBy="#{item.carsettings.model}" filterBy="#{item.carsettings.model}"&gt;
                                  &lt;f:facet name="header"&gt;
                                      &lt;h:outputText value="Model" /&gt;
                                  &lt;/f:facet&gt;
                                  &lt;h:outputText value="#{item.carsettings.model}" /&gt;
                              &lt;/p:column&gt;
                              &lt;p:column sortBy="#{item.carsettings.manufacturer}" filterBy="#{item.carsettings.manufacturer}"&gt;
                                  &lt;f:facet name="header"&gt;
                                      &lt;h:outputText value="Manufacturer" /&gt;
                                  &lt;/f:facet&gt;
                                  &lt;h:outputText value="#{item.carsettings.manufacturer}" /&gt;
                              &lt;/p:column&gt;
                          &lt;/p:dataTable&gt;
                      &lt;/h:form&gt;
                  &lt;/center&gt;
              &lt;/f:view&gt;
          &lt;/ui:define&gt;
      &lt;/ui:composition&gt;
  &lt;/h:body&gt;
  </code></pre>
  
  <p> </p>
  
  <p>Sorting is not working in the above code</p>
  
  <p>Please help</p>