我需要在商店的读取操作期间发送 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/