PDA

View Full Version : Uncaught TypeError: Cannot read property 'length' of undefined



a2rdvark
28 Oct 2010, 8:29 PM
hello.

i want to store json data to Ext.data.Store, but i have problem.

code is below :

Ext.regModel('names', {
fields : ['NAME1', 'REGIO', 'ORTO1', 'KUNNR', 'STRAS']
});

Ext.setup({
onReady : function() {
var jsonData = new Ext.data.Store({
autoLoad : true,
model : 'names',
proxy : {
type : 'ajax',
url : 'test.json',
reader : {
type : 'json',
root : 'CUSTOMER_GENERAL'
}
}
});
}
});

and content of test.json is below :

{"CUSTOMER_GENERAL" :[
{"NAME1":"asdf1","REGIO":"661","ORTO1":"sdfg1","KUNNR":"sdfg1","STRAS":"STRAS1"},
{"NAME1":"asdf2","REGIO":"662","ORTO1":"sdfg2","KUNNR":"sdfg2","STRAS":"STRAS2"},
{"NAME1":"asdf3","REGIO":"663","ORTO1":"sdfg3","KUNNR":"sdfg3","STRAS":"STRAS3"}
]
}

when i execute this js file at chrome browser

ext-touch-debug.js:6615 Uncaught TypeError: Cannot read property 'length' of undefined

error message come out.

how can i solve this problem?

thx for reading my question.

evant
28 Oct 2010, 8:56 PM
Make sure you're running the latest version, runs fine for me.

a2rdvark
28 Oct 2010, 9:33 PM
well..

i use the lates version. i downloaded it 2 hours ago..

my version is 0.98

evant
28 Oct 2010, 9:33 PM
It ran fine for me, I copied and pasted your code exactly.

stevek
23 Dec 2010, 3:37 PM
Hi,
I am doing something similar - and it does not work for me.
Here is my code below.


var store = new Ext.data.Store({
model: 'Audit',
proxy: {
extraParams: {filters: []},
reader: {
root: 'audits',
type: 'json'
},
type: 'rest',
url: 'audit/load'
}
});

store.proxy.extraParams.case_no = '20100001';
store.load();

Someone please help.

stevek
23 Dec 2010, 3:48 PM
Fixed the problem. I changed type: 'rest' to type: 'ajax' and it worked.
But this problem, I believe, is a bug for the rest proxy that should be fixed.
Can anyone indicate when v1.0.1a will be released to the public?

Say, any idea if the development team will add a grid panel widget to the sencha touch API (like they have in ExtJS). It's great that someone wrote the TouchGridPanel - but I would be a nice reflection on the API itself if this widget were part of its library.