ExtJs,如何使用POST方法在store.load()上发送JSON

Pet*_*ter 3 post json extjs store

我需要在商店的读操作期间发送JSON对象.标题和方法设置正确.

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
    }
});
Run Code Online (Sandbox Code Playgroud)

问题是POST主体是作为url编码的查询字符串发送的,而不是具有属性"filter"的JSON对象.

ExtJs版本4.2.2

Sak*_*aki 6

您可能正在寻找代理配置选项 paramsAsJson:true