1. #1
    Sencha User
    Join Date
    Oct 2010
    Posts
    33
    Answers
    4
    Vote Rating
    0
    jag2000 is on a distinguished road

      0  

    Question Answered: Little problems with Ext.List

    Answered: Little problems with Ext.List


    Hello,

    maybe I found a bug, but I would ask you first, before reporting. Perhaps I did a mistake. I tryed to load the content ov en Ext.List via ajax and read the response with json. Here is my config:

    Code:
    Ext.define('WebApp.model.PageModel', {
        extend:    'Ext.data.Model',
    
        config:    {
            fields:    [ 
                { name:    'id',       type:    'int'       },
                { name:    'pid',      type:    'int'       },
                { name:    'title',    type:    'string'    }
            ]
        }
    });
    
    
    Ext.define('WebApp.store.PageStore', {
        extend:     'Ext.data.Store',
    
        require:    [    'WebApp.model.PageModel'    ],
    
        config:     {
            model:        'WebApp.model.PageModel',
            storeId:      'PageStore',
            proxy:        {
                type:        'ajax',
                url:         'RpcServer/GetPages.php',
                reder:            {
                    type:    'json',
                    root:    'pages'
                },
                actionMethods:    {
                    read:    'POST'
                },
            }
        },
    });
    
    
    
    Ext.create('Ext.List', { 
        store:        'PageStore',
        height:        500,
        pinHeaders:    true,
        style:        'opacity:.9;',
        itemTpl:    '<div class="page">{title}</div>',
        items:        [{
            xtype:        'toolbar',
            docked:        'top',
            title:        'Menu'
        }]
    });
    If my server response a formatk like the following, all is fine.
    Code:
    [
        {
            "id":            55,
            "pid":           31,
            "title":         "General"
        },{
            "id":            169,
            "pid":           31,
            "title":         "About"
        }
    ]
    But I tryed to send some extra infos and whanted to send the json like this:

    Code:
    {
        "pages":    [{
            "id":            55,
            "pid":           31,
            "title":         "General"
        },{
            "id":            169,
            "pid":           31,
            "title":         "About"
        }],
        "total":    2,
        "metaData": {
            "idProperty":    "id",
            "rootProperty":  "pages",
            "totalProperty": "total",
            "fields":        [{
                "name": "id"
            },{
                "name": "pid"
            },{
                "name": "title"
            }]
        },
        "success":  true
    }
    In this case, my list shows only one item with the caption "null". I tryed several szenarios, where I did not send metaData and/or set the Property values of the json-reader-object, but nothing happens.

    Do you see my mistake, or is it realy a bug?

  2. Simple typo. In your WebApp.store.PageStore you have 'reder' but it should be 'reader'

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,065
    Answers
    3498
    Vote Rating
    852
    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


    Simple typo. In your WebApp.store.PageStore you have 'reder' but it should be 'reader'
    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.

  4. #3
    Sencha User
    Join Date
    Oct 2010
    Posts
    33
    Answers
    4
    Vote Rating
    0
    jag2000 is on a distinguished road

      0  

    Default OMG - I'am so stupid

    OMG - I'am so stupid


    I fixed my spelling mistake and now it's ok, but a little thing is also strange. I have had to define the rootProperty in the reader. Only the information in the metaData do not work, but ok, I can life with that point

Thread Participants: 1

Tags for this Thread