I'm using richfaces 4.0 and I'm adding some column filters on a rich:dataTable. Now, since I'm filtering a column that contains date, I would like to use a rich:calendar to filter the content of the table. So, following the examples I found, I added the following code to the .xhtml page:
<rich:column filter="#{rerunFilter.aodFilterImpl}">
<f:facet name="header">
<h:outputText value="Aod Rerun" />
<br/>
<rich:calendar id="aod"
datePattern="yyyy-MM-dd"
showWeekDaysBar="false"
showFooter="false"
value="#{rerunFilter.aodFilter}"
popup="true">
<a4j:ajax event="change" render="main:rerunListTable" execute="@this"/>
</rich:calendar>
</f:facet>
<h:outputText value="#{item.aod}">
<f:convertDateTime pattern="yyyy-MM-dd" />
</h:outputText>
</rich:column>
On the server side, I've the filter class where I added the following code:
private String aodFilter;
public String getAodFilter() {
return aodFilter;
}
public void setAodFilter(String aodFilter) {
logger.info("Received "+aodFilter);
this.aodFilter = aodFilter;
}
public Filter<?> getAodFilterImpl() {
return new Filter<Rerun>() {
public boolean accept(Rerun item) {
String aod = getAodFilter();
logger.info("Invoked with "+aod+" Item date "+item.getAod());
return true;
}
};
}
When I change the date, using the calendar, I saw in the log the property is correctly but there's something wrong, since I got an exception at the end
11:50:54,484 GRAVE [org.richfaces.log.Context] (http--127.0.0.1-8080-1) main:rerunListTable:j_idt38: 'Wed Oct 12 00:00:00 CEST 2011' could not be understood as a date.: javax.faces.convert.ConverterException: main:rerunListTable:j_idt38: 'Wed Oct 12 00:00:00 CEST 2011' could not be understood as a date.
Where am I wrong? thanks fil