2 Replies Latest reply on Feb 24, 2010 11:52 AM by eugenbesel

    Problem with external filtering with filtermethod and SortingBy

    eugenbesel

      Hello EveryBody,

       

       

      I use ExtendedDataTable with attribute <rich:columns.

          I would like to use all features of Extended Datatable.

      1.Sorting of Data

      2. Filtering of Data

      3. grouping of rows

       

      I would like to create own filter fields like selectBox. If I use external filter, I can validate the filterData.

      Also I should use external filtering with filterMethod like on

      http://livedemo.exadel.com/richfaces-demo/richfaces/filteringFeature.jsf?c=filtering&tab=ex-usage

       

      On this place I have two problems:

       

      1. I implemented the external filtering like in example, but it doesnt work. I have input fields in header of column (correct), BUT when I click into the filter field then my DataTable will rerendered directly although I set requestDelay="700". The filterfield stay empty but the focus is not in the field. also I have no possibility to enter the filter criteria.

       

      2.

      If I implement my external filter like on

      http://livedemo.exadel.com/richfaces-demo/richfaces/filteringFeature.jsf?c=filtering&tab=ex-usage

      then I have no possibility to sort my table any more. Exclude external filter the attribute sortBy ?????

       

      please take a look, on my code in attachment.

       

      I have no Idea what I have done wrong.

       

      PLEASE HEEEELPPPP .)

        • 1. Re: Problem with external filtering with filtermethod and SortingBy
          eugenbesel

          I change my jsf-page and now it works better.

           

          I can see external filter fields and also I can see symbols for sorting.

           

          requestDelay="700" works also.

           

          I dont know why, but the filter criteria are not seeted when I enter some of then in the filter field.

           

          I think that my Bean is wrong.

           

          but what? If I debugg in the

          <rich:columns id="col_#{col}" value="#{searchModul.columns}"
                           var="col" index="ind"
                           filterMethod="#{searchModul.filterData}"
                           sortBy="#{data[ind]}" sortOrder="#{searchModul.sortOrders[col]}">               
                          <f:facet name="header">
                            <h:inputText value="#{searchModul.columnFilterValues[col]}" id="input_#{ind}">
                                         <a4j:support event="onkeyup" reRender="extTable , ds"
                                                  ignoreDupResponses="true" requestDelay="700"/>
                              </h:inputText> 
                            
                       </f:facet> 
                       <h:outputText value="#{data[ind]}"></h:outputText>
                      </rich:columns>

           

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

           

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

           

           

          public boolean filterData(Object current) {
                  if(current==null){
                      return false;
                  }
                  List<String> filterData = (ArrayList<String>)current;
                  if(!columnFilterValues.keySet().isEmpty()){                                / /columnFilterValues is always empty
                     Iterator<String> iter = columnFilterValues.keySet().iterator();
                      int columnIndex=0;
                      while(iter.hasNext()){
                          String key = iter.next();
                          String data = (String)columnFilterValues.get(key);
                          if(!filterData.get(columnIndex).equals(data)){

                              return false;

                         }
                      }
                  }
          //        System.out.println(current.toString());
                  return true;
              }

          • 2. Re: Problem with external filtering with filtermethod and SortingBy
            eugenbesel
            its ok, I found the problem