Results 1 to 2 of 2

Thread: Problem with NestedList

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    17
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Vote Rating
    1297
      0  

    Default

    Are you running from a webserver? It will probably throw that error if the JSON file could not be found
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •