Results 1 to 3 of 3

Thread: Proxy extraParams not applied

  1. #1
    Ext JS Premium Member
    Join Date
    Aug 2011
    Posts
    37
    Answers
    1
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

  3. #3
    Ext JS Premium Member
    Join Date
    Aug 2011
    Posts
    37
    Answers
    1
    Vote Rating
    0
      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();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •