2 Replies Latest reply on Feb 24, 2010 11:50 AM by Eugene Bessel

    rich:EXTENDEDdataTable filterBy contains instead of startsWith

    Eugene Bessel Newbie

      Hello everyone,

       

      in demo:

      http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=modifiableDataModel&cid=4545363

      I see that filterBy can also use contains instead of startsWith conditions.

       

      In the example code I dont see any advice on this conditions.

       

      can anybody tell me, how I can switch from startWith to contains condition??

      is there only a flag for it, or should I implement the own filter condition?

       

      thank you

        • 2. Re: rich:EXTENDEDdataTable filterBy contains instead of startsWith
          Eugene Bessel Newbie

          hello Ilja,

           

          thank you for your advice. I took a look at this example.

           

          I saw, that the filter Method take a Objectvalue.

           

          public boolean filterStates(Object current) {
                  Capital currentCapital = (Capital)current;
                  if (filterValue.length()==0) {
                      return true;
                  }
                  if (currentCapital.getState().toLowerCase().startsWith(filterValue.toLowerCase())) {
                      return true;
                  }else {
                      return false;
                  }
              }

           

           

          and this method is used in jsp. like <rich:column filterMethod="#{filteringBean.filterStates}">

           

          how about <rich:columns ...

          without filterMethod I made:

          <rich:columns id="col_#{col}" value="#{searchModul.columns}"
                           var="col" index="ind"
                           filterBy="#{data[ind]}" filterEvent="onkeyup" sortBy="#{data[ind]}"
                           sortOrder="#{searchModul.sortOrders[col]}"
                          filterValue="#{searchModul.columnFilterValues[col]}">

           

           

          with Bean:

          public Map<String, Object> getColumnFilterValues() {
                  return columnFilterValues;
              }

           

              public void setColumnFilterValues(Map<String, Object> columnFilterValues) {
                  this.columnFilterValues = columnFilterValues;
              }

           

          so how should it work with filterMethod ????

           

          thank you for your answer.