1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    19
    Vote Rating
    0
    javi10823 is on a distinguished road

      0  

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

    Unanswered: 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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    Answers
    3107
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You have root : 'users' but no users tag in your XML.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    19
    Vote Rating
    0
    javi10823 is on a distinguished road

      0  

    Default error persist

    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
    shazia.gn is on a distinguished road

      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