Core JSF datatable pagination and sorting
posted 10 years ago
I'd make the headers into commandLinks and bind methods (action) to it that sort the query when clicked on. You could set a flag for ASC/DESC. So the first time the action is called it sorts ASC then next time the action is called it toggles the variable and sorts DESC, etc. When another action is called this flag is cleared and some other is set, thus it gets sorted by that other variables.