View Full Version : record.data empty? JSON produces empty array

3 Jan 2011, 9:33 AM
Hello, all. I hope someone can help me, I'm at a loss. And I hope this question wasn't asked before; I have searched, but couldn't find it.
Here it is:

I have this grid that I add rows to with this:

orderdetailDataStore.add(record);That works fine, it shows up as it should.
Then, when it is filled, it should be saved into the database. First I tried the JSONwriter, but that sent empty requests to the server, so I tried to do it by hand, with:

params: {
id_order: neworderid,
data: Ext.encode(record.data)
};This sent empty requests also, so I tried to see what was sent exactly, so I tried this:

for(i in record.data){
alert('record.data: '+i+' : '+record.data[i]);
var dataJSON = Ext.encode(record.data);
alert('JSON: '+dataJSON.toString());
};This showed that record.data wasn't empty, and contained the correct data. But it also showed that dataJSON would be filled with an empty array. So I looked into it with Firebug. This showed that record.data was filled, but the length was set to 0; this also showed when Ext tries to encode the array into JSON: the loop to encode every entry of the array isn't looped once (Ext-all-debug.js, line 4302)(var l gets set to 0).

Ideas, anyone?

9 Jan 2011, 4:38 AM
This one can be closed, I got the solution here: http://www.sencha.com/forum/showthread.php?120642-Writer-sends-empty-array