is it possible sort primefaces datagrid data? as i’m aware it’s possible in data table.if it is not possible by default,is there any other way to do it? Thanks
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Primefaces datagrid does not provide sorting nor filtering, and it seems that there are no plans for implementing it anytime soon.
I’ve implemented sorting in a datagrid using a p:selectOneMenu just above the datagrid with sorting options like “Date”, “Price (highest first)”, “Price (lowest first)”, etc. When the selected value changes, I use an ajax event to invoke a method that reloads the collection from database using the appropiate ORDER BY.
Example:
And in the managed bean:
And in your ejb