【问题标题】:ExtJs, how to send JSON on store.load() using POST methodExtJs,如何使用 POST 方法在 store.load() 上发送 JSON
【发布时间】:2014-10-12 12:13:19
【问题描述】:

我需要在存储读取操作期间发送 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 编码的查询字符串发送的,而不是带有属性“过滤器”的 JSON 对象。

ExtJs 版本 4.2.2

【问题讨论】:

    标签: json post extjs store


    【解决方案1】:

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

    【讨论】:

    • 但是,如果你想发出 POST 请求并发送一些参数作为查询参数,休息作为请求负载怎么办?
    猜你喜欢
    • 1970-01-01
    • 2015-11-21
    • 1970-01-01
    • 1970-01-01
    • 2012-05-13
    • 1970-01-01
    • 1970-01-01
    • 2011-11-11
    • 1970-01-01
    相关资源
    最近更新 更多