1. #1
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676
    Vote Rating
    8
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default Store and multiple filters

    Hi,

    i have a Ext.Store with static data. To filter with one param is no problem, but how can I apply multiple filters?
    In API Store.filter is defined as (filter,value) so i don't no how to apply more like
    company:ba,city:be etc.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  2. #2
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    510
    Vote Rating
    5
    MaximGB is on a distinguished road

      0  

    Default

    Why not to use Store::filterBy()?
    Use the force - read the source.

  3. #3
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676
    Vote Rating
    8
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default

    Hi,

    i would like to, but i don't know how to use. In Doku it's only declared by function with 2 args.
    What have i to do - validate each record and return true or false?
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,566
    Vote Rating
    54
    Animal will become famous soon enough Animal will become famous soon enough

      0  

    Default

    http://extjs.com/deploy/ext/docs/out....html#filterBy

    Yes, the documentation is totally clear:

    2 params:

    Parameters:

    * fn : Function
    The function to be called, it will receive 2 args (record, id)
    * scope : Object
    (optional) The scope of the function (defaults to this)

    Filter by a function. The specified function will be called with each record in this data source. If the function returns true the record is included, otherwise it is filtered.

    Where's the problem?

  5. #5
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676
    Vote Rating
    8
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default

    The specified function will be called with each record in this data source. If the function returns true the record is included, otherwise it is filtered.
    This was the point what was not clear, now i know, thx animal.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,566
    Vote Rating
    54
    Animal will become famous soon enough Animal will become famous soon enough

      0  

    Default

    That's a direct quote from the documentation.

  7. #7
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676
    Vote Rating
    8
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default

    some times late night I read in API without reading instead of go to sleep
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  8. #8
    Sencha User
    Join Date
    Jul 2009
    Posts
    66
    Vote Rating
    1
    ssawchenko is on a distinguished road

      1  

    Default

    I'd like to preface this by saying that I am an EXT noob... and have really only been using the library for a few days now.

    That being said, I am also looking to apply multiple filters, but I was hoping to apply them in stages. ie. User does a search for something and the data is filtered, then the user does a second search on the already filtered data.

    I was hoping that you could simply do subsequent filterBy calls on the data store, but this appears to not be the case. My second filterBy seemingly searches ALL records [even ones previously filtered out].

    Is there a way to do this?
    Thanks!

  9. #9
    Sencha User StevenInc's Avatar
    Join Date
    Jul 2009
    Location
    NYC
    Posts
    72
    Vote Rating
    0
    StevenInc is on a distinguished road

      0  

    Default I would be interested in this too.

    Thanks
    Steven Benjamin
    Senior Coldfusion Developer


    www.stevenbenjamin.com

  10. #10
    Sencha User
    Join Date
    Oct 2012
    Posts
    3
    Vote Rating
    0
    Moksh is on a distinguished road

      0  

    Default filterBy not working but filter works!!

    Following code:
    var store = Ext.data.StoreManager.get("SampleStore");
    store.filterBy(function (record) //scope is optional so I dint use it.
    {
    return (record.get("Name") == "Jack");
    });

    not working but

    store.filter("Name","Jack");
    works!!

    Please help.