我不明白我怎么能告诉代理只是将数据作为普通的http参数提交给post-request。您可能认为这是最简单的事情,但我不能让我的商店在CRUDing时向服务器发送除xml或json之外的任何内容。
请告诉我,我错过了一些非常简单的事情。
Ext.define('ObjectManager.store.Object', {
extend: 'Ext.data.Store',
model: 'ObjectManager.model.Object',
autoLoad: true,
proxy: {
type: 'ajax',
api:{
read: 'http://localhost/Get/',
update: 'http://localhost/Edit/',
create: 'http://localhost/Add/',
delete: 'http://localhost/Delete/'
},
reader: {
type: 'xml',
root: 'objects',
record: 'object'
}
}
});
答案 0 :(得分:4)
对于记录,可以使用以下配置配置Proxy per CRUD操作使用的方法:
actionMethods: {
create : 'POST',
read : 'POST',
update : 'POST',
destroy: 'POST'
}
答案 1 :(得分:-1)
这是一个存储配置,它读取JSON并将数据作为POST发送。我相信关键是在编写器配置中:“encode:true”
/* Data store */
Ext.create('Ext.data.Store', {
storeId:'categoryStore',
model: 'Model.Category',
autoLoad: true,
autoSync: true,
groupField: 'CategoryParent',
proxy: {
type: 'ajax',
api: {
read: '',
create: '',
update: '',
destroy: ''
},
reader: {
type: 'json',
root: 'data'
},
writer: {
root: 'data',
encode: true,
allowSingle: false
}
}
});