Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExtJs, how to send JSON on store.load() using POST method

I need to send JSON object during read operation on store. Headers and method are set correctly.

var proxyDefinition = {
    type : 'rest',
    api : {
        read : '/some/url'
    },
    actionMethods : {
        create  : 'POST',
        read    : 'POST',
        update  : 'PUT',
        destroy : 'DELETE'
    },
    reader : {
        type : 'json'
    }        
};

var store = Ext.create('Ext.data.Store', {
    proxy : proxyDefinition,
    model : 'SomeModel'
});

// this needs to send JSON
store.load({
    params : {
        filter: [] // some filtering rules
    }
});

Problem is that POST body is sent as url encoded query string, not JSON object with property "filter".

ExtJs version 4.2.2

like image 401
Peter Avatar asked Dec 30 '25 18:12

Peter


1 Answers

It is likely that you are looking for proxy config option paramsAsJson:true

like image 66
Saki Avatar answered Jan 01 '26 07:01

Saki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!