views:

560

answers:

1

I have a jsonstore that is supposed to load a user's information. I have its HTTPRequest as a GET but when I finally do load up the store with parameters, it automatically changes to a POST request.

I've done something similar to this before, except it was a regular datastore, and the request stayed as a GET. Is the default behavior of a jsonstore when supplied with params to do a POST request?

 var userDisplayStore = new Ext.data.JsonStore({
  url : myurl/userinfo,
  method : 'GET',
  fields : ['firstName', 'lastName', 'email', 'userName'],
  id : 'user-display-store',
  root : 'data'
 });

 userGridPanel.on('rowclick', function(grid, dataIndex, event) {
  var dataRow = grid.getStore().getAt(dataIndex);
  userDisplayStore.load({
   params : {username : dataRow.data.username}
  });
 });
+2  A: 

Try using a proxy with your store... and the method gets set as part of the proxy.

I think it would be something like this:

       var userDisplayStore = new Ext.data.JsonStore({
                fields : ['firstName', 'lastName', 'email', 'userName'],
                id : 'user-display-store',
                root : 'data',
                proxy : new Ext.data.HttpProxy({
                     method: 'GET',
                     url: 'myurl/userinfo'

                })
        });
Spike Williams
Hi Spike,Thanks! That did it! This is how I would create a request with a regular data store, but the ext api mentioned that json store was pre-configured with a built-in HttpProxy so I never thought I'd need to use a proxy. Again, thanks!-Snowright
Snowright