我有一个存储配置了代理POST
数据到服务器。我动态地向这家商店添加记录。在商店上调用sync()
方法后,数据被发送到服务器。但看着网络流量,我发现整个记录数据都被发送出去了。如何配置商店仅发送单个数据(如仅记录的ID)?Ext JS Store POST请求过滤参数
我试图seeting的WriteAllFields
属性设置为false在连接到代理的JSON writter但这并没有帮助
我自己也尝试这种方法:Ext.JS Prevent Proxy from sending extra fields但请求甚至没有进行
var documentStore = Ext.getStore('Document');
var trashStore = Ext.getStore('TrashDocuments');
documentStore.each (function(record) {
console.debug(record);
//record.phantom = true;
//record.setDirty();
trashStore.add(record);
documentStore.remove(record);
});
var newWriter = Ext.create('Ext.data.writer.Json',{
getRecordData: function(record){
return {'id':record.data.id};
}
});
trashStore.getProxy().setWritter(newWritter);
trashStore.sync({
success: function()
{
console.debug("success!!");
},
failure: function()
{
console.debug("failed...");
},
callback: function()
{
console.debug("calling callback");
},
scope: this
});
console.debug("END");
你是如何修改记录的?你有没有可能在上面设置脏标志? – lascort
我将记录从另一个商店添加到此商店,然后调用sync() – Jacob