I am having trouble getting the PrimeFaces dataTable component\'s sort behavior to work as documented. (I am using PrimFaces 4.0, JSF 2.1.12, and Tomcat 7.0.) The problem I
My datatable was not sorting due to the existence of lazy="true". When I removed that, it worked. I realize you are not using that attribute, however.
Your firs string is
<p:dataTable id="dataTable" var="car" value="#{tableBean.cars}">
so tableBean has a method
public List<Car> getCars()
{
return carEJB.findAll();
}
but your bean has no variable to save method result after sort.
Solution:
public class CarController
{
...
private List<Car> cars;
...
privare void reset()
{
cars = carEJB.findAll();
}
...
public List<Car> getCars()
{
return cars;
}
}
remove the pound and curly bracket like this:
From this:
<p:column sortBy="#{car.manufacturer}">
To this
<p:column sortBy="manufacturer">
I had the same problem and it was simply because of that.