1. #1
    Sencha User
    Join Date
    Nov 2009
    Posts
    58
    Vote Rating
    -1
    emils is on a distinguished road

      0  

    Default Answered: How to load a store with POST params ?

    Answered: How to load a store with POST params ?


    Hello,


    The situation is:
    I have 2 grids. When user selects a row from first grid, the second grids store must load data only for a specific ID ( selected in first grid). In Extjs 3 i use load({params:..... }).


    I wonder how to load data with POST params in store?


    Thanks!

  2. It is the same in ExtJs 4. You can put the params in an object

    Code:
    var params = new Object();
    params['id'] = id;
    
    store.load({params: params});
    also you can set extraParams in the proxy. And for posting as far you haven't done you set the actionMethods in the proxy to post.

    Code:
    actionMethods: { create: 'POST', destroy: 'POST', read: 'POST', update: 'POST' }

  3. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,114
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    It is the same in ExtJs 4. You can put the params in an object

    Code:
    var params = new Object();
    params['id'] = id;
    
    store.load({params: params});
    also you can set extraParams in the proxy. And for posting as far you haven't done you set the actionMethods in the proxy to post.

    Code:
    actionMethods: { create: 'POST', destroy: 'POST', read: 'POST', update: 'POST' }

  4. #3
    Sencha User
    Join Date
    Nov 2009
    Posts
    58
    Vote Rating
    -1
    emils is on a distinguished road

      0  

    Default


    Yes, you are right. The combination of:

    actionMethods: { create: 'POST', destroy: 'POST', read: 'POST', update: 'POST' },

    and extraParams works fine for me, thanks!

  5. #4
    Sencha User
    Join Date
    Feb 2010
    Posts
    125
    Answers
    7
    Vote Rating
    3
    börn is on a distinguished road

      0  

    Default


    but why do you abuse the POST for a simple parameter? You can use GET with parameters as well, don't you?

Thread Participants: 2