我有一個存儲配置了代理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