1. #1
    Sencha Premium Member
    Join Date
    Nov 2011
    Posts
    1
    Vote Rating
    0
    Michael Bogucki is on a distinguished road

      0  

    Default Unanswered: Remote store filter with comparison parameter

    I try to filter my store remotly with comparision. Ext.util.Filter seems to have no comparison parameter (or at least i didn't found any). Something like the following code failed. The additional parameter isn't sent to the server.
    Code:
     my_store.filter([{property: "date_to", value: myDate, comparison: "ls"}]);
    Is there any way to add custom parameters to your filter which can be submited to the server? Or is there an other way to solve this issue?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,605
    Vote Rating
    1143
    Answers
    3711
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    I usually add the filter stuff to extraParams and handle that on the server instead of using the store filter.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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 in print!

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

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    8
    Vote Rating
    0
    mostafaHTC is on a distinguished road

      0  

    Default

    hi
    how to remove extra param when filter is clear?

  4. #4
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    622
    Vote Rating
    29
    Answers
    67
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default

    PHP Code:
    store.on('filterschange'
    function(
    storefilters) {   
     if(!
    filters || !filters.length) {   
    store.proxy.extraParams = {};
    }
    }); 
    or something
    Latest thoughts on the subject: http://joy2share.com/senchatouch/

  5. #5
    Sencha User
    Join Date
    Apr 2010
    Posts
    8
    Vote Rating
    0
    mostafaHTC is on a distinguished road

      0  

    Default

    This will erase all the extraparams, but I need to clean the filter params.

  6. #6
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    622
    Vote Rating
    29
    Answers
    67
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default

    don't be lasy that filter management is fairly easy
    Latest thoughts on the subject: http://joy2share.com/senchatouch/

  7. #7
    Sencha User
    Join Date
    Apr 2010
    Posts
    8
    Vote Rating
    0
    mostafaHTC is on a distinguished road

      0  

    Default

    I use bellow code for setting extraparam when filter is change
    Code:
        onFilterUpdateRender:  function(grid,filters) {
            var jsonFilters = grid.getFilterData();
             if(!filters || !filters.length) {   
                this.store.proxy.extraParams = {}; 
            }
            Ext.each(jsonFilters, function(f) {
                var param = f.field;
                this.store.proxy.extraParams[param]=f.data.value;
            }, this);
        },
    i set extra param of this store from controller with bellow code
    Code:
        this.store.proxy.extraParams.id=1;
    and finally the bellow code will erase all the extra params although I need to clean the filter params
    how i can remove anly filter extra params?

  8. #8
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    622
    Vote Rating
    29
    Answers
    67
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default

    on settting the filters keep track of names:
    PHP Code:
    onFilterUpdateRender:  function(grid,filters) {        var jsonFilters grid.getFilterData();         if(!filters || !filters.length) {               this.store.proxy.extraParams = {};         }this.store.myExtraFilters this.store.myExtraFilters || [];        Ext.each(jsonFilters, function(f) {            var param f.field;            this.store.proxy.extraParams[param]=f.data.value;            this.store.myExtraFilters.push(param);        }, this);    }, 
    on cleaning the filters, you just delete what is stored in this.store.myExtraFilters
    PHP Code:
    Ext.Array.each(this.store.myExtraFilters, function(f){  delete me.store.proxy.extraParams[f];});this.store.myExtraFilters =  []; 
    Latest thoughts on the subject: http://joy2share.com/senchatouch/