Hello,
This problem is now solved (the version explained below is
working)
(..but don't ask me why, there's some kind of magic around
!)
Rgds
FJ
De : Jecker Frédéric (LFR) [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 21 octobre 2005 11:02
À : [email protected]
Objet : DataTable Sorting not working
Hello,
I have the following problem:
I have a page displaying a dataTable that can be modified by the users
(add/update/delete row) this works fine.
Now I tried to implement sortable headers on my table.
To do this I added the following properties
to the bean managing the table :
I have a page displaying a dataTable that can be modified by the users
(add/update/delete row) this works fine.
Now I tried to implement sortable headers on my table.
To do this I added the following properties
to the bean managing the table :
private String sort="ident";
private boolean ascending=false;
private boolean ascending=false;
With their getters/setters
public String getSort(){}
public void setSort(String sortColumn){}
public boolean isAscending(){}
public void setAscending(boolean ascending) {}
public void setSort(String sortColumn){}
public boolean isAscending(){}
public void setAscending(boolean ascending) {}
I also modified my dataTable, adding the sortColum
and sortAscending properties:
<x:dataTable
var="art"
binding="#{GabaritManager.articlesList}"
value="#{GabaritManager.articles}"
sortAscending="#{GabaritManager.sort}"
sortColumn="#{GabaritManager.ascending}"
>
<h:column>
<f:facet name="header">
<x:commandSortHeader columnName="ident" arrow="true">
<h:outputText value="Ident"/>
</x:commandSortHeader>
</f:facet>
<h:outputText value="#{art.ident}"/>
</h:column>
[...]
<x:dataTable
var="art"
binding="#{GabaritManager.articlesList}"
value="#{GabaritManager.articles}"
sortAscending="#{GabaritManager.sort}"
sortColumn="#{GabaritManager.ascending}"
>
<h:column>
<f:facet name="header">
<x:commandSortHeader columnName="ident" arrow="true">
<h:outputText value="Ident"/>
</x:commandSortHeader>
</f:facet>
<h:outputText value="#{art.ident}"/>
</h:column>
[...]
Finally I updated the method returning the table
value to take the sorting into account
Now when i load the form i always have the following error:
Now when i load the form i always have the following error:
2005-10-21 10:54:33,830 [http-8080-Processor23]
ERROR org.apache.myfaces.renderkit.html.HtmlGridRenderer - Exception while
rendering children of panel-grid.
java.lang.ClassCastException
at org.apache.myfaces.component.html.ext.HtmlDataTable.getSortColumn(HtmlDataTable.java:685)
java.lang.ClassCastException
at org.apache.myfaces.component.html.ext.HtmlDataTable.getSortColumn(HtmlDataTable.java:685)
I tried a lot of things but none worked (like
changing the ascending property to String)
Btw, i'm using myfaces 1.0.9 (bundled with
MyEclipseIDE)
Thanks for your help
FJ

