开发者

ExtJs sends multiple XHR requests for every item when i hit delete

I have a ExtJs(v3.1) `Ext.grid.GridPanel that loads some records from its store and allows editing.

If i select multiple records, and I click the delete it sends multiple DELETE requests, overwhelms the server, which eventually deletes some of them , returns 404 for the rest.

I don't understand why it sends a second or third request before the first has开发者_StackOverflow中文版 failed, it just has not returned.

this is the handler for the delete button

function onDelete() {
 var recs = userGrid.getSelectionModel().getSelections();
 userGrid.store.remove(recs); //delete multiple selections one at a time

}

and the store its based on

// Typical Store collecting the Proxy, Reader and Writer together
var store = new Ext.data.GroupingStore({
    proxy: proxy,
    reader: reader,
    writer: writer,
    sortInfo: { // Default sort by day decsending grouped by week
        field: 'day',
        direction: "DSC"
    }, groupField: 'week',


     batch: false, // update each record with an individual XHR request, the server doesnt process batch requests
});

this is a screenshot of firebug after i highlighted 5 records and clicked delete

ExtJs sends multiple XHR requests for every item when i hit delete


Gee that line:

 batch: false, // update each record with an individual XHR request, the server doesnt process batch requests

sure looks suspicious ... I bet that that's just what Ext does, given that it'd be pretty slow to actually wait for each response before sending the next.

(I agree however that just blasting out a whole bunch of overlapping HTTP transactions like that is not terribly smart.)


I have the similar issue, but I was able to fix it by calling onCommitChanges() on the data store once the store is modified.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜