1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    5
    Vote Rating
    0
    Iggy_ is on a distinguished road

      0  

    Default Where did setBaseParam go in ExtJS 4?

    Where did setBaseParam go in ExtJS 4?


    Hi All,

    I'm switching to ExtJS 4 from 3 and noticed that setBaseParam is missing under proxy.

    So where did setBaseParam go in ExtJS 4?

    When I look at the documentation for load() function in ExtJS 4, it says that it expects a config object of Ext.data.Operation wich doesn't say it supports 'params' config.

    So what is the workaround?

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

      0  

    Default


    There are no base params. The proxy has extraParams that is the same thing.
    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
    Sencha User
    Join Date
    Nov 2011
    Posts
    5
    Vote Rating
    0
    Iggy_ is on a distinguished road

      0  

    Default


    Yes, I noticed that. There would still be handy to have something like setExtraParams() to add params to the request.

    If someone is looking for the same thing the following does the trick:

    store.getProxy().extraParams.someparameter1 = newValue1;
    store.getProxy().extraParams.someparameter2 = newValue2;

    Source: http://www.sencha.com/forum/archive/...t-145757.html?

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

      0  

    Default


    I do this a lot:

    Code:
    Ext.apply(store.proxy.extraParams, {
        foo : 'bar'
    });
    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.

  5. #5
    Sencha Premium Member aiky.cc's Avatar
    Join Date
    Aug 2012
    Location
    Novosibirsk, Russia
    Posts
    25
    Vote Rating
    0
    aiky.cc is on a distinguished road

      0  

    Default


    Mitchell, and what about:

    Code:
     
    Ext.apply(store.proxy.extraParams, {     
      'foo' :{
          'foofoo':'bar',
          'arr':[1,2,3]
      }
    });
    So, how to add multi-dimensional hashes/arrays?

  6. #6
    Sencha Premium Member aiky.cc's Avatar
    Join Date
    Aug 2012
    Location
    Novosibirsk, Russia
    Posts
    25
    Vote Rating
    0
    aiky.cc is on a distinguished road

      0  

    Default


    Ок, I was found next way for 4.1.x:

    Code:
    var data = ['foo','ofo','oof'];
    for(var i = 0; i < data.length; i++) store.proxy.setExtraParam('data[' + i + ']',data[i] );
    but why not simple applyEncoding before buildRequest for extraParams at Ext.data.proxy.Server, source code:
    Code:
    buildRequest: function(operation) {         
      var me = this, 
      params = operation.params = Ext.apply({}, operation.params, me.extraParams)
     ...
    as it makes for sorters and filter params, why not?

Thread Participants: 2