-
1. Richfaces 4: Datatable and client side sort don´t work
nbelaevski Feb 18, 2011 7:09 AM (in response to flaviohenrique)Hi,
Works as deisgned - see showcase examples.
-
2. Richfaces 4: Datatable and client side sort don´t work
flaviohenrique Feb 18, 2011 10:56 AM (in response to nbelaevski)I follow the showcase and now I am able to sort, BUT if I click twice, only the first click is processed.
ManagedBean code related to sorting:
(...)
private SortOrder nomeOrder = SortOrder.unsorted;
public void sortByNome(){
if (this.nomeOrder.equals(SortOrder.ascending)) {
this.nomeOrder = SortOrder.descending;
} else {
this.nomeOrder = SortOrder.ascending;
}
}
Page code:
?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>
<h:body>
<h:form>
<rich:dataTable id="tabela" value="#{meuMB.pessoas}" var="pessoa" rows="5"
noDataLabel="Não há dados" sortMode="single">
<rich:column id="a1" sortBy="#{pessoa.nome}"
sortOrder="#{meuMB.nomeOrder}">
<f:facet name="header">
<a4j:commandLink value="Nome" render="tabela"
action="#{meuMB.sortByNome}" />
</f:facet>
<h:outputText value="#{pessoa.nome}" />
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputLabel value="Idade" />
</f:facet>
<h:outputText value="#{pessoa.idade}" />
</rich:column>
<f:facet name="footer">
<rich:dataScroller />
</f:facet>
</rich:dataTable>
</h:form>
</h:body>
</html>
-
3. Richfaces 4: Datatable and client side sort don´t work
ilya_shaikovsky Feb 21, 2011 4:56 AM (in response to flaviohenrique)meuMB should be view or session scoped.
-
4. Richfaces 4: Datatable and client side sort don´t work
cfrisod Mar 18, 2011 10:51 AM (in response to ilya_shaikovsky)I have the same problem. But I noticed it is dependant on how much rows there are in the table. With 5 rows it goes wrong. With 4 rows it is ok. The sort method called by the a4j:commandLink gets called for 5 times when I got 4 rows and for 6 times when I got 5 rows. I think this is not how it is supposed to be. It should be called 1 time right?
-
5. Richfaces 4: Datatable and client side sort don´t work
nbelaevski Mar 18, 2011 11:12 AM (in response to cfrisod)Hi,
Yes, this is a bug. Already fixed in the latest SNAPSHOT.