Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ext JsonStore doing a POST even if I set it to GET

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}
        });
    });
like image 337
Snowright Avatar asked Dec 22 '22 08:12

Snowright


1 Answers

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'

                })
        });
like image 153
Spike Williams Avatar answered Jan 04 '23 19:01

Spike Williams