filterBy in rich:columns
bhanine May 28, 2008 11:09 AMHello,
I found something strange in the filterBy of rich:columns:
When i want to filter the first column of my dataTable or even the others columns, it goes to filter the last column of my table.
Thank you for your help.
/------------------------------------------------------------------------------------------------------------- Code xhtml /------------------------------------------------------------------------------------------------------------- <!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:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" xmlns:a="http://richfaces.org/a4j"> <head> </head> <body> <f:view> <h:form> <rich:dataTable rows="40" value="#{tableBean.cars}" var="car" sortMode="single"> <rich:columns value="#{tableBean.columns}" var="column" sortBy="#{car.values[column]}" filterBy="#{car.values[column]}" filterEvent="onkeyup"> <f:facet name="header"> <h:outputText value="column #{column}" /> </f:facet> <h:outputText value="#{car.values[column]}" /> </rich:columns> </rich:dataTable> </h:form> </f:view> </body> </html> /----------------------------------------------------------------------------------------------------------- Code Java of TableBean /----------------------------------------------------------------------------------------------------------- import java.util.ArrayList; @Name("tableBean") @Scope(ScopeType.SESSION) public class TableBean { private List<CarBean> cars; private List<Integer> columns; public List<CarBean> getCars() { if (cars==null){ cars = new ArrayList<CarBean>(); for(int id=0;id<10 ;id++) cars.add(new CarBean()); } return this.cars; } public List<Integer> getColumns() { if (columns==null){ columns = new ArrayList<Integer>(); for(int id=0;id<5 ;id++) columns.add(id); } return this.columns; } } /----------------------------------------------------------------------------------------------------------- Code Java of CarBean /----------------------------------------------------------------------------------------------------------- import java.util.ArrayList; import java.util.List; public class CarBean { private List<String> values; public List<String> getValues() { if (values==null){ values = new ArrayList<String>(); for(int id=0;id<5 ;id++) values.add("Column "+id+" "+hashCode()); } return this.values; } }