【发布时间】:2016-04-01 08:44:20
【问题描述】:
我们在 ExtJS 4.2 中有以下存储:
Ext.define('Example.store.BasketDocuments', {
extend: 'Ext.data.Store',
model: 'Example.model.Document',
autoLoad: true,
autoSync: true,
sorters: [
{
property: 'doc_type',
direction: 'ASC'
}
],
proxy: {
type: 'rest',
url: baseUrl + 'document_basket',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json;charset=utf-8'
},
reader: {
type: 'json',
root: 'items'
},
writer: {
type: 'json'
},
actionMethods: {create: "POST", read: "GET", update: "PUT", destroy: "DELETE"}
}
});
它附加到具有拖放功能的网格。
当我们将大约 10 个文件(其中 9 个有效)拖到将立即更新存储的网格时,我们会收到服务器错误,因为我们没有为类似 URL 实现 POST 功能
/api/document_basket/1964?_dc=1459498608890&{}
这只是一个条目。
对于其他人来说是
/api/document_basket?_dc=1459498608941&{}
哪个有效。
仅拖动单个条目有效。
所以 ExtJS 正在发送一个带有 ID 的 POST 请求,它应该是一个 PUT 代替?这是为什么呢?
【问题讨论】:
标签: javascript extjs extjs4