Results 1 to 3 of 3

Thread: ExtJS JsonStore

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default ExtJS JsonStore

    i making my first steps with ExtJs and cant figure out whats the problem with this example...
    the grid is showing but with no records

    Code:
    Ext.onReady(function () {
    
        var store = new Ext.data.JsonStore({
            root: 'results',
            autoLoad: true,
            fields: ['name'],
            data: {
                results: [
                { "name": "John Smith" },
                { "name": "Anna Smith" }
                ]
            }
        });
        
        var grid = new Ext.grid.GridPanel({
            width: 600,
            height: 200,
            store: store,
            columns: [
                {
                    id: 'name',
                    header: "NAME",
                    sortable: true,
                    dataIndex: 'name'
                }
            ],
        });
    
        // render grid
        grid.render('db-grid');
    
    });

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    347
    Vote Rating
    119
      0  

    Default

    Try to config the store a below:
    Code:
        var store = new Ext.data.JsonStore({
            //root: 'results',
            //autoLoad: true,
            fields: ['name'],
            proxy: {
                type: 'memory',
                reader: {
                    root: 'results'
                }
            },
            data: {
                results: [
                { "name": "John Smith" },
                { "name": "Anna Smith" }
                ]
            }
        });

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default

    it works... thx

Posting Permissions

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