ExtJs-Apply dynamic filter on "Numeric" Filter type not working

217 Views Asked by At

I am working on applying filters dynamically on ExtJs(5.1.3) Grid columns(i get filter criteria values which need to be searched in Grid Store).It worked for me in "string" type filters.But for none of the remaining filter types say List, date I am unable to apply the filters to store. Here is my code sample,

if (cols[i].FilterType == "number" && (cols[i].Filter[0] != null || cols[i].Filter[1] || cols[i].Filter[2])) {
                            var fil = {
                                property: cols[i].DataIndex,
                                value: {
                                    gt: cols[i].Filter[0],
                                    lt: cols[i].Filter[1],
                                    eq: cols[i].Filter[2]
                                }
                            };
                            filterArray.push(fil);
                        }

                    }
                    listStore.filter(filterArray);
1

There are 1 best solutions below

0
Adithya On

Found the solution for the issue,

        var filterArray=[];  
        //for numeric filter
          var fil = {
                     operator: lt, //type may be lt,gt,eq
                     value: 500,
                     property: grid.columns[i].dataIndex,
                     type: "float"
                     };
         filterArray.push(fil); 
      store.addFilter(filterArray);
  • In the above code "filterArray" is a common array where multiple types of filters are stored.

  • In the similar way we can filter date type filters.