2 Replies Latest reply on Feb 26, 2010 5:36 AM by Eugene Bessel

    problem with dynamic filter criteria

    Eugene Bessel Newbie

      hello every body,

       

      I use ExtendedDataTable with <rich:columns...

       

      I would like to implement the dynamic external filter.

      that's mean, that I dont want to define whether the Filter field is a textField or ComboBox. This decision must come from my bean.

       

      I created the  following jsp:

      <rich:columns id="col_#{col2}" value="#{searchModul.columns}"
                       var="col2" index="ind" width="200"
                       filterMethod="#{searchModul.filterData}"
                       sortBy="#{data[ind]}" sortOrder="#{searchModul.sortOrders[col2]}">

      <f:facet name="header">

           <h:outputText value="#{col2}"/>

      </f:facet>

      <f:facet name="filter">
            <h:selectOneMenu value="#{searchModul.columnFilterValues[col2]}" id="combo_filter_#{col2}"
                       
      rendered="#{fn:containsIgnoreCase(searchModul.comboColumn, col2)}" >
                 <f:selectItems value="#{searchModul.selectItem}" />
                  <a4j:support event="onchange" reRender="extTable, ds" />
            </h:selectOneMenu>
           <h:inputText value="#{searchModul.columnFilterValues[col2]}" immediate="true"
                   id="input_filter_#{col2}" maxlength="5"
                  
      rendered="#{fn:containsIgnoreCase(searchModul.textFilter, col2)}">
             <a4j:support event="onkeyup" reRender="extTable , ds"
                ignoreDupResponses="true" requestDelay="700"/>
          </h:inputText> 
      </f:facet>

       

      the parameter textFilter and comboColumn are setted, so that the first column should have textField as Filter and the third column should have ComboBox as Filterfield.

       

      It works, I I use it separatly. that's mean If I have only inputText or selectOneMenu in the filter above.

      like

      <f:facet name="filter">
             <h:selectOneMenu value="#{searchModul.columnFilterValues[col2]}" id="combo_filter_#{col2}"
                        
      rendered="#{fn:containsIgnoreCase(searchModul.comboColumn, col2)}" >
                  <f:selectItems value="#{searchModul.selectItem}" />
                   <a4j:support event="onchange" reRender="extTable, ds" />
             </h:selectOneMenu>
       
      </f:facet>

       

       

      But if I let both filter like in the first example, then only the last filter is shown, not both of them.

       

      Any Idea, how can I display this dynamic filter???

       

      thank you