1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    34
    Vote Rating
    1
    Oxii is on a distinguished road

      0  

    Default Can't filter multiple extjs grid columns

    Can't filter multiple extjs grid columns


    To filter one grid column I use:
    Code:
    store.filter({      
        property: 'first_name',    
         anyMatch: true,     
        value   : this.getValue()  
        });

    Now I need to search multiple fields at once, something like:

    Code:
          var filters = [ 
       new Ext.util.Filter({  
      property: "first_name",
     anyMatch: true, 
    value: this.getValue()  
      }),  
      new Ext.util.Filter({ 
      property: "last_name",
     anyMatch: true, 
    value: this.getValue()  
     }) ];
      store.filter(filters);

    The weird thing is that in both cases, only single search works


    EDIT

    Now I tried:

    Code:
    store.filter([{property: "first_name", anyMatch: true, value: this.getValue()},{property: "last_name", anyMatch: true, value: this.getValue()}]);

    it worked but as an AND condition, like when user types 'ma' .. it retrieved the names but only those contains 'ma' in both first and last names. I need it to be OR. How can I do this ?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Trying using filterBy and pass in a function where returning true will keep the record in the store, false will filter it out of the store.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread