-
1. Re: how to make a column in dataTable sortable?
dxxvi May 4, 2007 7:31 AM (in response to vh)You can do something like this:
<h:dataTable id="dataTable" value="#{yourbean.yourdata}" var="row"> <h:column> <f:facet name="header"> <a4j:commandLine value="Column 1" action="#{yourbean.sortColumn1}" reRender="dataTable" /> </f:facet> <h:outputText value="#{row.attribute1}" /> </h:column> <h:column> <f:facet name="header"> </f:facet> <h:outputText value="#{row.attribute2}" /> </h:column> </h:dataTable>
where yourdata is a list of beans containing attribute1 and attribute2. This is the sortColumn1 method:public String sortColumn1() { // sort your yourdata list return null; }
and don't forget to put the <h:dataTable> in a <h:form>. -
2. Re: how to make a column in dataTable sortable?
vh May 7, 2007 1:28 PM (in response to vh)So there is no build in suport for sorting? (I have to do everything myself?).
Do I need to remember which column and which order I am soring in etc? -
3. Re: how to make a column in dataTable sortable?
sergeysmirnov May 7, 2007 8:16 PM (in response to vh)So, as dxxvi suggested, you need one command on the page and one method in java. What else is needed to just go ahead?
P.S. Sounds curiously, but built-in support will require much more steps from your side to customize it. -
4. Re: how to make a column in dataTable sortable?
vh May 7, 2007 9:08 PM (in response to vh)In woodstock, by default all the table columns are sortable based on the datatype in that column.
There is an attribute in woodstock to tell which column you want to initially sort on and the order. It also shows a small arrow in the column header to indicate the order.
Think that might be useful. -
5. Re: how to make a column in dataTable sortable?
ilya_shaikovsky May 8, 2007 3:37 AM (in response to vh)Such component planned, and the one reason it was planned so far from initial releases as Sergey already said - that there are not so large work to write own sorting method and use ajax-ed controls in headers for example.
-
6. Re: how to make a column in dataTable sortable?
dxxvi May 9, 2007 9:53 AM (in response to vh)"vh" wrote:
So, in woodstock, does it sort the data table by comparing the Java objects or does it allow us to specify a sort method where we can compare Java objects or do a sql statement?
In woodstock, by default all the table columns are sortable based on the datatype in that column.
There is an attribute in woodstock to tell which column you want to initially sort on and the order. It also shows a small arrow in the column header to indicate the order.
Think that might be useful. -
7. Re: how to make a column in dataTable sortable?
flow1986 May 12, 2007 7:42 PM (in response to vh)http://jboss.com/index.html?module=bb&op=viewtopic&t=107574
FYI
best wishes
flow