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

标签 json post extjs store

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

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

最佳答案

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

关于json - ExtJs,如何使用 POST 方法在 store.load() 上发送 JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25382665/

相关文章:

json - 无法将 json 编码为 protobuf 消息

jquery - 通过 JQuery 和 JSON 设置 ASP LinkBut​​ton 控件的文本

javascript - 如何创建 getter 和 setter

javascript - Extjs:定期执行一个函数

ios - 创建 JSON 并格式化 double 值

javascript - 自动将 json 操作为具有不同结构的对象

forms - Nodejs POST 请求多部分/表单数据

javascript - 从 JS 发布表单值数组

asp.net-mvc - 是否可以通过 POST 而不是 GET 进行 RedirectToRoute?

javascript - 无论如何,有没有办法避免由于达到 Ext JS 应用程序的内存限制而导致 chrome 崩溃