2 Replies Latest reply on Jun 17, 2013 9:14 AM by dageisz

    4.3.1: ExtendedDataTable: filterType custom and clearing of filter input doesnt work correctly

    dako ak Newbie

      I have a simple extendedDataTable with one column (firstName) with a filter input component within the header. This is the default filter input created by the extendedDataTable. The second column (city) has a filterType="custom" and an inputText componenent within the header. The filterType attribute with value "custom" is ignored because the default input text is rendered too.

      The second problem with the input filter is that I can't clear this filter input text components by a a4j:commandButton. The table is correct filtered but the filter input text fields are not cleared.


      I have created a JIRA issue, but maybe someone has a workaround?


      Within this JIRA issue you can download a simple test project to reproduce the problems.


      And now the code:


      XHTML page

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      <html xmlns="http://www.w3.org/1999/xhtml"
          <title>RichFaces-Test: start page</title>
          <h3>RichFaces-Test: start page</h3>
          <h:form id="overviewForm">
                  <h:outputText value="List of persons:" /> 
                  <a4j:commandButton value="Clear filter and refresh" action="#{overviewController.clearFilter()}" render="overviewTable" execute="@form"/>
              <rich:extendedDataTable id="overviewTable" rowKeyVar="index"
                  value="#{overviewController.tableItems}" var="tableItem"
                  <f:facet name="header">
                  <rich:column id="city" filterValue="#{overviewController.cityFilter}" filterType="custom"
                      filterExpression="#{fn:containsIgnoreCase(tableItem.city, fn:trim(overviewController.cityFilter))}">
                      <f:facet name="header">
                          <h:outputText value="City" />    
                          <h:inputText id="cityFilter" style="width:99.9%" value="#{overviewController.cityFilter}">
                              <a4j:ajax event="change" render="overviewTable" execute="@this" />
                      <h:outputText value="#{tableItem.city}" />                
                  <rich:column id="firstName" filterValue="#{overviewController.firstNameFilter}"
                      filterExpression="#{fn:containsIgnoreCase(tableItem.firstName, fn:trim(overviewController.firstNameFilter))}">
                      <f:facet name="header">
                          <h:outputText value="First Name" />    
                      <h:outputText value="#{tableItem.firstName}" />                
                  <rich:column id="country">
                      <f:facet name="header">
                          <h:outputText value="Country" />    
                      <h:outputText value="#{tableItem.country}" />                



      The code of the overviewController:





      public class OverviewController implements Serializable{


          private static final long serialVersionUID = 544466031058458542L;


          private List<TableItem> tableItems;

          private String[] columnsOrder;

          private String cityFilter;

          private String firstNameFilter;



          public void postConstruct() {

              System.out.println("start: postConstruct");


              tableItems = new ArrayList<TableItem>();

              tableItems.add(new TableItem("Oliver", "New York", "USA"));

              tableItems.add(new TableItem("Jane", "Washington", "USA"));

              tableItems.add(new TableItem("Fred", "Berlin", "Germany"));

              tableItems.add(new TableItem("Thomas", "London", "England"));


              columnsOrder = new String[] {"firstName", "city", "country" };



          public void clearFilter() {


              cityFilter = "";

              firstNameFilter = "";






          public List<TableItem> getTableItems() {

              return tableItems;



          public void setTableItems(List<TableItem> tableItems) {

              this.tableItems = tableItems;



          public String[] getColumnsOrder() {

              return columnsOrder;



          public String getCityFilter() {

              return cityFilter;



          public void setCityFilter(String cityFilter) {

              this.cityFilter = cityFilter;



          public String getFirstNameFilter() {

              return firstNameFilter;



          public void setFirstNameFilter(String firstNameFilter) {

              this.firstNameFilter = firstNameFilter;





      Best regards