PDA

View Full Version : Problem with NestedList



ChristineBauers
9 Nov 2011, 7:06 AM
Hi there,

I've tried the sencha nested list tutorial and I got the following problem:

This is the application:


new Ext.Application({
name: "NestedListDemo",
launch: function() {
this.views.viewport = new this.views.Viewport();
}
});




This is the viewport:

NestedListDemo.views.Viewport = Ext.extend(Ext.NestedList, {
fullscreen: true,
title: 'Products',
store: NestedListDemo.music_store
});

This is the model:

Ext.regModel('ListItem', {
fields: [
{name: 'firstname', type: 'string'},
{name: 'lastname', type: 'string'},
{name: 'age', type: 'string'}

]
});



This is the store:


NestedListDemo.music_store = new Ext.data.TreeStore({
model: 'ListItem',
proxy: {
type: 'ajax',
url: 'tracks.json',
reader: {
type:'json',
root: 'items'
}
}
});



And this is my json document:


{"items":
[{
"firstname": "firstname1",
"lastname": "lastname1",
"age": "1"
},{
"firstname": "firstname2",
"lastname": "lastname2",
"age": "2"
},{
"firstname": "firstname3",
"lastname": "lastname3",
"age": "3"
}]
}

The tutorial says, that the screen should now show a list of the elements from the json document, but I get the following exception:

OPTIONS file:///C:/Dokumente und Einstellungen/lyth/workspace/NestedList/assets/www/tracks.json?_dc=1320850691003&node=root



Uncaught TypeError: Cannot read property 'length' of undefined

Ext.data.TreeStore.Ext.extend.fillNodesencha-touch.js:6
Ext.data.TreeStore.Ext.extend.onProxyLoadsencha-touch.js:6
(anonymous function)sencha-touch.js:6
Ext.data.Connection.Ext.extend.onCompletesencha-touch.js:6
Ext.data.Connection.Ext.extend.onStateChangesencha-touch.js:6
(anonymous function)




Anybody got an idea what to do now?

Thanks in advance
Greetings

Christine

mitchellsimoens
18 Nov 2011, 3:26 PM
Are you running from a webserver? It will probably throw that error if the JSON file could not be found