Sorting is not working in datatable in PrimeFaces. Please suggest.
See below my .xhtml file
The primefaces backing bean (ViewScoped!) must hold it's own List of rows. So, e.g., if you query the database every time you request the p:dataTable:value, sorting will not work.
Solution: Collect the List from the Database and keep it in a local List variable in the backing bean.
public List getDataTable() {
if (tableDataList == null)
tableDataList = loadListOnce();
return tableDataList;
}