15 Aug 2018, 11:23
First, there is an open ticket in PrimeFaces Issue Tracker, which points to this question, but was recently labeled "will not be corrected."
However, I found a good solution. The PrimeFaces table classification can be activated by calling an undocumented JavaScript method in the data table widget. The following may not work for future versions of PrimeFaces, but it does for 3.4.2:
Just add the following to your component, which activates the update:
oncomplete="myTableWidget.sort($(PrimeFaces.escapeClientId('#{p:component('sortColumnId')}')), 'ASCENDING')"
<p:dataTable id="myTable"
widgetVar="myTableWidget"
value="#{myArticles}"
var="article"
sortBy="#{article.price}"
sortOrder="ASCENDING">
...
<p:column id="price" sortBy="#{article.price}">
<f:facet name="header">
<h:outputText value="Price" />
</f:facet>
<h:outputText value="#{article.price}" />
</p:column>
</p:dataTable>
Update table work like this
<p:commandButton value="refresh" action="#{tableController.refreshPrices}" update="myTable" oncomplete="myTableWidget.sort($(PrimeFaces.escapeClientId('#{p:component('price')}')), 'ASCENDING')" />