-
1. How to use external sorting for extendedDataTable in RichFaces 4 M6?
ilya_shaikovsky Feb 21, 2011 4:52 AM (in response to tinfailhat)1 of 1 people found this helpfulcheck richfaces-showcase sample code. yes for now we have no built-in controls but providing only base attributes to map the sort orders and conditions.
B.t.w. notice the refactoring Modifiable model -> Arrangeable model between 3.3.x and 4.x.
-
2. How to use external sorting for extendedDataTable in RichFaces 4 M6?
tinfailhat Feb 21, 2011 1:56 PM (in response to ilya_shaikovsky)OK, so if I figured things out right, you're supposed to:
1. Bind the sortOrder and sortPriority attributes to a backing bean. Also define the sortBy attributes to contain something useful. (In my case it was column names.)
2. Implement your own sortBy() methods. In those methods manage the sortOrder and sortPriority collections yourself.
3. What RichFaces seems to do for you is that it takes the values of sortOrder and sortPriority, and calls Arrangeable.arrange() with them.
What I don't know is: how does step 3 work? I only have column names and SortOrder values in those collections, but arrange() gets called with ValueExpressions.
What I'm also missing however is preserving the sortOrder / sortPriority between requests - right now I can only get this to work by declaring my bean as @ViewScoped. If I use @RequestScoped my sortOrder and sortPriority are empty every time sortBy is called. Shouldn't data tables save their sorting / filtering state like a datascroller does?
-
3. Re: How to use external sorting for extendedDataTable in RichFaces 4 M6?
ilya_shaikovsky Feb 22, 2011 4:27 AM (in response to tinfailhat)1. Bind the sortOrder and sortPriority attributes to a backing bean. Also define the sortBy attributes to contain something useful. (In my case it was column names.)
not column names but object properties should be there. like #{tableVar.objectProp}
What I'm also missing however is preserving the sortOrder / sortPriority between requests - right now I can only get this to work by declaring my bean as @ViewScoped. If I use @RequestScoped my sortOrder and sortPriority are empty every time sortBy is called. Shouldn't data tables save their sorting / filtering state like a datascroller does?
When the table will be added with built-in control it will be like you describing. Als it's already works in that way if just use sorting JS API (without having to manage the sortOrder on your own). check the richfaces-showcase. ComponentControl sample in Misc contains sample of filtering with JS API and you could do the same for sorting. Then you will not have to store sort order on your own.
-
4. Re: How to use external sorting for extendedDataTable in RichFaces 4 M6?
ilya_shaikovsky Feb 22, 2011 4:33 AM (in response to ilya_shaikovsky)here is even more simple example:
<h:form>
<rich:dataTable value="#{capitalsBean.capitals}" var="cap" id="table">
<rich:column sortBy="#{cap.name}" id="name">
<f:facet name="header">
<a4j:commandLink value="Sort by Capital Name" onclick="#{rich:component('table')}.sort('name')"/>
</f:facet>
<h:outputText value="#{cap.name}" />
</rich:column>
</rich:dataTable>
</h:form>