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

时间:2014-08-19 11:50:01

标签: json post 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
    }
});

问题是POST正文是作为url编码的查询字符串发送的,而不是带有属性" filter"的JSON对象。

ExtJs版本4.2.2

1 个答案:

答案 0 :(得分:6)

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