PDA

View Full Version : [FIXED] store.load leads to a too much recursion in ext-all-debug.js (Linie 7528



crp_spaeth
9 May 2009, 4:35 AM
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.



(
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();

It seems to me that there is something wrong in the creating transaction routine.
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.

crp_spaeth
9 May 2009, 7:10 AM
btw. this problem doesn't appear in Ext3.0-rc-1.0

aconran
9 May 2009, 7:34 AM
Thanks for the bug report. We'll look into it.

crp_spaeth
9 May 2009, 10:36 AM
I didn't know where i should place this thread into... Ext.Direct or into Bugs... Maybe someone should move it into bugs...

shibubh
10 May 2009, 2:22 AM
change
{"name":"getData","len": 1}, to {"name":"getData","len": 0},

and it works

crp_spaeth
10 May 2009, 11:09 AM
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...

shibubh
10 May 2009, 8:32 PM
i think there is a problem on Extjs DirectStore class.

shibubh
10 May 2009, 8:54 PM
and if you want to have a len =1 then
reconfigure DirectStore and set paramsAsHash: true

evant
12 May 2009, 2:43 AM
This has been resolved in SVN. As the previous poster said, if you want to send params you need to use paramsAsHash or paramOrder.