-
28 Aug 2012 6:15 AM #1
[4.1] duplicate ajax requests by store with autoSync on record removal
[4.1] duplicate ajax requests by store with autoSync on record removal
REQUIRED INFORMATION
Ext version tested:- Ext 4.1.1
- Ext 4.1.0
- FF 14 (firebug 1.10.2 installed)
- Chrome 21
- XHTML 1.0 Transitional
- When removing n rows quickly after each other, (n + n-1 + n-2 + ... + 1) DELETE requests are fired at the REST server.
- Situation: textbook gridpanel and REST store with autoSync enabled
- Remove 3 rows immediately after eachother
- This REST server in this case responds with either {success: true, data: [], msg: 'some msg'} or {success: false, data: [], msg: 'error msg'}
- 3 DELETE XHR requests are fired at the REST server. Concurrently or serially, I don't care.
- 3+2+1 = 6 DELETE XHR requests are fired. 3 for one record, 2 for the second and 1 for the last.
HELPFUL INFORMATIONPHP Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" lang="nl" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../js/extjs-4.1.1/ext-all-debug-w-comments.js"></script>
<link rel="stylesheet" type="text/css" href="../js/extjs-4.1.1/resources/css/ext-all.css" />
<script type="text/javascript">
var teststore, testgrid;
Ext.onReady(function() {
Ext.define('part', {
extend: 'Ext.data.Model'
,fields: [
{name: 'id', type: 'int'}
,{name: 'title', type: 'string'}
]
});
teststore = Ext.create('Ext.data.Store', {
model: 'part',
autoSync: true
,autoLoad: true
,remoteFilter: true
,proxy: {
type: 'rest'
,url: 'someUrl'
,reader: {
type: 'json'
,root: 'data'
}
,writer: {
type: 'json'
}
}
});
testgrid = Ext.create('Ext.grid.Panel', {
title: 'test'
,renderTo: 'testgridcnt'
,store: teststore
,columns: [
{text: 'id', dataIndex: 'id'}
,{text: 'title', dataIndex: 'title'}
]
});
});
</script>
</head>
<body>
<div id="testgridcnt"></div>
<a href="#" onclick="teststore.removeAt(1);teststore.removeAt(2);teststore.removeAt(3);return false;">test me!</a>
</body>
</html>
Screenshot:- attached
- none
- This might be similar to EXTJSIV-4335, which is supposed to be fixed in 4.1.1?
- suspend and resumeAutosync works, but is not an option.
- only default ext-all.css
- Fedora 16
-
28 Aug 2012 6:44 AM #2
Certainly we could improve some of that code to be smarter, but it's not really what autoSync is intended for.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
16 Nov 2012 3:11 PM #3
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote