-
9 May 2009 4:35 AM #1
[FIXED] store.load leads to a too much recursion in ext-all-debug.js (Linie 7528
[FIXED] store.load leads to a too much recursion in ext-all-debug.js (Linie 7528
Hi there,
trying to get a direct store running under the Extjs 3.0-rc1.1 and under the current Headversion (3917) breaks with a too much recursion exception.
I was able to break the error down to the following source.
It seems to me that there is something wrong in the creating transaction routine.PHP Code:(
function(){
Ext.app.REMOTING_API = {
url: "any url",
type:"remoting",
"actions":
{
"TestAction":
[
{"name":"doEcho","len":1},
{"name":"multiply","len":2},
{"name":"submit","formHandler": true,"len": 1},
{"name":"getData","len": 1},
{"name":"createData","len": 1},
{"name":"deleteData","len": 1},
{"name":"saveData","len": 2}
]
}
};
}
)();
Ext.Direct.addProvider(Ext.app.REMOTING_API);
var reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id',
root: 'data'
}, [
{ name: 'id' },
{ name: 'email', allowBlank: false },
{ name: 'first', allowBlank: false },
{ name: 'last', allowBlank: false }
]);
var writer = new Ext.data.JsonWriter({
returnJson: true,
writeAllFields: false
});
var store = new Ext.data.DirectStore({
api: {
load: TestAction.getData,
create: TestAction.createData,
save: TestAction.saveData,
destroy: TestAction.deleteData
},
reader: reader,
writer: writer, // <-- plug a DataWriter into the store just as you would a Reader
paramsAsHash: false,
batchSave: false,
prettyUrls: false,
listeners: {
load: function(result) {
},
loadexception: function() {
},
scope: this
}
});
store.load();
Since you can set a breakpoint in the queueTransaction methode you will see that the transaction the method gets called with, has a data propertie containing an array. the array then contains an object with a propertie called scope.
Since scope is a self referencing object the encode routine will end up with a too much recursion exception.
-
9 May 2009 7:10 AM #2
btw. this problem doesn't appear in Ext3.0-rc-1.0
-
9 May 2009 7:34 AM #3
Thanks for the bug report. We'll look into it.
Aaron Conran
@aconran
Sencha Architect Development Team
-
9 May 2009 10:36 AM #4
I didn't know where i should place this thread into... Ext.Direct or into Bugs... Maybe someone should move it into bugs...
-
10 May 2009 2:22 AM #5
change
{"name":"getData","len": 1}, to {"name":"getData","len": 0},
and it worksShibu Bhattarai
Use JavaScript beautifier to beautify you code http://jsbeautifier.org/
Code Conventions http://javascript.crockford.com/code.html
ExtJS Core Manual http://extjs.com/products/extcore/manual/
-
10 May 2009 11:09 AM #6
Thank you shibubh!
Seems to work with len set to 0 but I don't really get it...
Since the store may calls the getData Function with a parameter sort for example this len propertie doesn't seem to fit...
*** edit ***
Okay i gave it a try and since len is 0 the data propertie posted to the Server is null even if i do a sort...Last edited by crp_spaeth; 10 May 2009 at 12:15 PM. Reason: tested remoteSort with len = 0
-
10 May 2009 8:32 PM #7
i think there is a problem on Extjs DirectStore class.
Shibu Bhattarai
Use JavaScript beautifier to beautify you code http://jsbeautifier.org/
Code Conventions http://javascript.crockford.com/code.html
ExtJS Core Manual http://extjs.com/products/extcore/manual/
-
10 May 2009 8:54 PM #8
and if you want to have a len =1 then
reconfigure DirectStore and set paramsAsHash: trueShibu Bhattarai
Use JavaScript beautifier to beautify you code http://jsbeautifier.org/
Code Conventions http://javascript.crockford.com/code.html
ExtJS Core Manual http://extjs.com/products/extcore/manual/
-
12 May 2009 2:43 AM #9
This has been resolved in SVN. As the previous poster said, if you want to send params you need to use paramsAsHash or paramOrder.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!


Reply With Quote
