I have a grid with the RowEditing plugin whose Store's AjaxProxy uses a JsonWriter to write updates back to the server.
When an update occurs, I need to fire some code to update another component, which requires a separate trip to the server.
This has to fire after the JsonWriter comes back, since it depends on the data being updated on the server. So, I can't listen for the store's "update" event, since that occurs before the Ajax call is made (even with batching disabled).
I tried putting a listener for "endupdate", as follows, but that again fires before the AJAX request is made:
var ds = new Ext.data.Store({
model: modelname,
autoSync: true,
proxy: {
type: "ajax",
api: {
create: "ajax.aspx?xaction=create",
read: "ajax.aspx?xaction=read",
update: "ajax.aspx?xaction=update",
destroy: "ajax.aspx?xaction=destroy"
},
batchActions: false,
reader: { type: "json", rootProperty: "rows", totalProperty: "results" },
writer: { type: "json", encode: true, writeAllFields: true, rootProperty: "rows" }
},
listeners: {
load: { fn: reloadPreview },
endupdate: { fn: reloadPreview }
}
});
I don't send any response back from the server for the writer's "update" call... I can't seem to find any documentation on what AjaxProxy or JsonWriter is expecting back, and sending a blank response seems to work.
Did you try to add listener to "write" event ?
write( store, operation, eOpts ) Fires whenever a successful write has been made via the configured Proxy
http://docs.sencha.com/extjs/5.0.0/apidocs/#!/api/Ext.data.Store-event-write
来源:https://stackoverflow.com/questions/24663392/how-can-i-listen-for-success-in-an-ajax-proxy-in-extjs-5