• Post Reply Bookmark Topic Watch Topic
  • New Topic

Core JSF datatable pagination and sorting

 
Dhanya Pillai
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using <h atatable> pagination.I want the records on the page to be sorted based on the user's choice of the column header. I want to sort only those records on the page (not the entire list).
How do I do that?

I have the entire list in the session.

Thanks,
Dhanya.
 
Gerardo Tasistro
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!