1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    17
    Vote Rating
    0
    ChristineBauers is on a distinguished road

      0  

    Default Problem with NestedList

    Problem with NestedList


    Hi there,

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

    This is the application:

    Code:
    new Ext.Application({
        name: "NestedListDemo",
        launch: function() {
            this.views.viewport = new this.views.Viewport();
        }
    });
    Code:
    This is the viewport:
    
    NestedListDemo.views.Viewport = Ext.extend(Ext.NestedList, {
        fullscreen: true,
        title: 'Products',
        store: NestedListDemo.music_store
    });
    This is the model:
    Code:
    Ext.regModel('ListItem', {
        fields: [
            {name: 'firstname', type: 'string'},
            {name: 'lastname', type: 'string'},
            {name: 'age', type: 'string'}
          
        ]
    });
    This is the store:

    Code:
    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:

    Code:
    {"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

    • [COLOR=red !important]Uncaught TypeError: Cannot read property 'length' of undefined[/COLOR]
      • [COLOR=red !important]Ext.data.TreeStore.Ext.extend.fillNode[/COLOR]sencha-touch.js:6
      • [COLOR=red !important]Ext.data.TreeStore.Ext.extend.onProxyLoad[/COLOR]sencha-touch.js:6
      • [COLOR=red !important](anonymous function)[/COLOR]sencha-touch.js:6
      • [COLOR=red !important]Ext.data.Connection.Ext.extend.onComplete[/COLOR]sencha-touch.js:6
      • [COLOR=red !important]Ext.data.Connection.Ext.extend.onStateChange[/COLOR]sencha-touch.js:6
      • [COLOR=red !important](anonymous function)[/COLOR]

    Anybody got an idea what to do now?

    Thanks in advance
    Greetings

    Christine

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,398
    Vote Rating
    849
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Are you running from a webserver? It will probably throw that error if the JSON file could not be found
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.