Results 1 to 4 of 4

Thread: Uncaught TypeError: Cannot read property 'length' of undefined reading xml in a list

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    19
    Vote Rating
    0
      0  

    Default Uncaught TypeError: Cannot read property 'length' of undefined reading xml in a list

    this is my code:

    Ext.setup({
    onReady : function () {

    Ext.regModel('User', {
    fields : ['id', 'name', 'email']
    });

    var store = new Ext.data.Store({
    model : 'User',
    autoLoad : true,
    proxy : {
    type : 'ajax',
    url : 'users.xml',
    reader : {
    type : 'xml',
    root : 'users',
    record : 'user'
    }
    }
    });

    var list = new Ext.List({
    fullscreen : true,
    singleSelect : true,
    store : store,
    itemTpl : '{id} {name} {email}',
    centered : true,
    emptyText : 'No XML'
    });

    list.show();

    }
    });


    this is my xml

    <?xml version="1.0" encoding="UTF-8"?>
    <user>
    <id>1</id>
    <name>Ed Spencer</name>
    <email>ed@sencha.com</email>
    </user>
    <user>
    <id>2</id>
    <name>Abe Elias</name>
    <email>abe@sencha.com</email>
    </user>


    this is mi index

    <!DOCTYPE html>
    <html>
    <head>
    <title>Hola Mundo!!!</title>
    <script src="lib/sencha/sencha-touch.js" type="text/javascript"></script>
    <link href="lib/sencha/sencha-touch.css" rel="stylesheet" type="text/css" />
    <script src="app/xml.js" type="text/javascript"></script>



    </head>
    <body></body>
    </html>

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    You have root : 'users' but no users tag in your XML.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    19
    Vote Rating
    0
      0  

    Default error persist

    <?xml version="1.0" encoding="UTF-8"?>
    <users>
    <user>
    <id>1</id>
    <name>Ed Spencer</name>
    <email>ed@sencha.com</email>
    </user>
    <user>
    <id>2</id>
    <name>Abe Elias</name>
    <email>abe@sencha.com</email>
    </user>
    </users>

  4. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    1
    Vote Rating
    0
      0  

    Default

    Hi, Were you able to solve this problem. I am too facing the same issue. Can someone please help me?

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
  •