-
1. Re: datatable ->get currently sorted column
ilya_shaikovsky Sep 29, 2008 8:26 AM (in response to janson12)you could provide value binding for sortOrder attribute and check its value.
-
2. Re: datatable ->get currently sorted column
janson12 Sep 29, 2008 8:54 AM (in response to janson12)somehow sortOrder always returns "UNSORTED".
-
3. Re: datatable ->get currently sorted column
janson12 Sep 29, 2008 8:56 AM (in response to janson12)oops...my fault...wrong column selected...
-
4. Re: datatable ->get currently sorted column
janson12 Sep 29, 2008 10:02 AM (in response to janson12)isn't there any variable that holds the state of the whole table such as colum 3 sorted ascending?! the point is that i need to reproduce a query that the user has entered. so when he comes back to the page the previously entered criteria plus results should be displayed (including the sorting of columns and the correct datascroller-page). i can fetch the values of every single column by the above mentioned approach which however will take me ages (and pages) for 3 tables consisting of over 7 columns each....
-
5. Re: datatable ->get currently sorted column
tarsia Jan 15, 2009 6:07 AM (in response to janson12)Hello, sorry for my newbie-question. In need to save (remember) the sortOrder without having to implement 'External Sorting', too.
I noticed your advice to bind the sortOrder (see topic above or topic: http://jboss.com/index.html?module=bb&op=viewtopic&t=140333).
I understand the idea, but i don't know how to manage it. I looked for an example, but can't find any.
Would you be so kind to give an short code-example or exact advice how to bind the sortOrder, please.
I tried something like this:<rich:dataTable value="#{accounts}" var="item" ...> <rich:column sortBy="#{item.accountNo}" sortOrder="#{accountHandler.so1}" binding="#{accountHandler.so1}" > ...
or<rich:column sortBy="#{item.accountNo}" sortOrder="#{accountHandler.so1}" >
"accountHandler.so1" is declared as a string in the bean.
The last example is working then 'so1" is initialzied with "ASCENDING" for example. The sorting is correct when opening the page first, but i get a unexpected error in the page, then i try to change the sorting of the column.
I managed to "remember" a filter value in a similar way (filterValue="#{accountHandler.f1}"), which is working fine.
So would someone give a short code-example or exact advice how to bind the sortOrder, please.
Many, many thanks for your help. -
6. Re: datatable ->get currently sorted column
nbelaevski Jan 15, 2009 6:33 AM (in response to janson12)Hello,
Try using this: org.richfaces.model.Ordering as property type. -
7. Re: datatable ->get currently sorted column
tarsia Jan 15, 2009 10:16 AM (in response to janson12)Many thanks, it's working. For others, here is a short overview of my changes in the bean:
import org.richfaces.model.Ordering; ... private Ordering sort1; ... public void init(){sort1 = Ordering.UNSORTED;} ...
also implemented the getters / setters
The web-page looks like this:<rich:column sortBy="#{item.name}" sortOrder="#{bean.sort1}" ... >