1. #1
    Ext JS Premium Member
    Join Date
    Aug 2011
    Posts
    37
    Answers
    1
    Vote Rating
    0
    jakobgrannas is on a distinguished road

      0  

    Default Unanswered: Proxy extraParams not applied

    Unanswered: Proxy extraParams not applied


    Hi,

    I'm trying to provide a set of extraParams to my proxy before I load my store, but it seems as though the extraParams are not applied to the proxy and the ajax request is therefore unsuccessful.

    Code:
    list.getStore().getProxy().extraParams = {
                dateFrom: Ext.Date.format(dateFrom, 'Y-m-d H:i:s'),
                dateTo: Ext.Date.format(dateTo, 'Y-m-d H:i:s')
    };
    list.getStore().load();
    However, if I apply the parameters to the load() method instead - like in the code below - everything works perfectly fine. I used to be able to set the extraParams like above until B1, so I'm guessing something has changed in the B1...

    Code:
    list.getStore().load({
                params: {
                    dateFrom: Ext.Date.format(dateFrom, 'Y-m-d H:i:s'),
                    dateTo: Ext.Date.format(dateTo, 'Y-m-d H:i:s')
                }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,824
    Answers
    3470
    Vote Rating
    836
    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

      1  

    Default


    extraParams is not a property of the proxy.

    Code:
    var store = new Ext.data.Store({
        fields   : ['test'],
        proxy    : {
            type   : 'ajax',
            url    : 'data.json',
            reader : 'json'
        }
    });
    
    var proxy = store.getProxy();
    
    proxy.setExtraParams({
        foo : 'bar'
    });
    
    proxy.setExtraParam('sencha', 'touch');
    
    store.load();
    You can see how I use setExtraParams (notice the 's' at the end) if you need to set multiple at once but if you just need to set one then you can use the setExtraParam (without the 's' at the end)
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    Ext JS Premium Member
    Join Date
    Aug 2011
    Posts
    37
    Answers
    1
    Vote Rating
    0
    jakobgrannas is on a distinguished road

      0  

    Default


    EDIT: My bad. SetExtraParams seems to work perfectly fine. I forgot that I was loading multiple stores from the same, general method, and I'd forgotten that I'd commented out the proxy on one of them, hence the error.

    I get this error when trying to use setExtraParams() or setExtraParam() on proxy.

    Code:
    Object [object Object] has no method 'setExtraParams'
    Here's my code:

    Code:
    list.getStore().getProxy().setExtraParams({
                dateFrom: Ext.Date.format(dateFrom, 'Y-m-d H:i:s'),
                dateTo: Ext.Date.format(dateTo, 'Y-m-d H:i:s')
    });
    list.getStore().load();

Thread Participants: 1