【发布时间】:2012-02-22 07:05:07
【问题描述】:
我有一个网格和 REST 存储(代理类型“rest”)。更改存储数据时,我需要向服务器发送删除/放置/发布请求。 这是商店的代码:
this.store = Ext.create('Ext.data.Store', {
model:this.model,
addCondition:function (key, value) {
this.proxy.extraParams[key] = value;
return this;
},
sorters:[
{
property:'NAME',
direction:'ASC'
}
],
proxy:{
storeId:'storemicorid',
type:'rest',
extraParams:{
model:this.model
},
url:document.head.baseURI + 'rest',
/*api:{ //tried this too
read:document.head.baseURI + 'rest',
create:document.head.baseURI + 'rest',
destroy:document.head.baseURI + 'restd',
update:document.head.baseURI + 'rest'
},*/
reader: {
type: 'json',
root: 'data'
},
writer: {
type: 'json',
encode: true,
root: 'data'
},
actionMethods:{
create: "POST",
destroy: "DELETE",
read: "GET",
update: "PUT"
}
}
});
当我删除任何记录时
clientgrid.store.remove(selection);
没有对服务器的请求。网格可以加载数据,但不调用服务器。尝试了 ajax 和 rest 存储,尝试更改 writers、actionMethods、urls 和 api...找不到原因..请帮忙...
【问题讨论】:
-
如果手动调用 store.sync() 会怎样?
-
当我在删除项目后调用 sync() 时,它会将网格中第一条记录的数据发送到代理设置中设置的地址。 json格式。
标签: javascript extjs