Results 1 to 3 of 3

Thread: Beginner Help: Grid not loading data

  1. #1
    Sencha User
    Join Date
    Oct 2009
    Posts
    15

    Default Beginner Help: Grid not loading data

    Hi, I hope someone can help, Im very new to ExtJs.
    Im simply trying to populate a simple grid with some data from an ajax request.
    However the grid loads, but there's no data. And firebug show no request either.
    Im abit stumped.

    Here's my code:

    Code:
    Ext.BLANK_IMAGE_URL = '/scripts/extjs/resources/images/default/s.gif';
    
    Ext.onReady(function() {
        
        var ds = new Ext.data.JsonStore({
            url: 'Home/Get',
            root: 'data',
            idProperty: 'Id',
            sortInfo: {
                field: 'Name',
                direction: 'ASC'
            },
            fields: [
                {name: 'Id', type: 'int'},
                {name: 'Name', type: 'string'},
                {name: 'Salary', type: 'float'},
                {name: 'Active', type: 'boolean'}
            ]
        });
        
        var colModel = new Ext.grid.ColumnModel([
            { header: "Id", width: 60, sortable: true},
            { header: "Name", width: 150, sortable: true, id: 'company'},
            { header: "Salary", width: 100, sortable: true},
            { header: "Active", width: 100, sortable: true, resizable: false}
         ]);
     
        var grid = new Ext.grid.GridPanel({
            store: ds,
            colModel: colModel,
            width: 600,
            height: 300,
            title: 'My GridPanel',
            frame: true        
        });
        
        
        new Ext.Container({
            renderTo: document.body,
            items: [grid]
        });
    });
    I cannot figure what Im doing wrong, can anyone spot it?

  2. #2
    Sencha User
    Join Date
    Oct 2009
    Posts
    15

    Default Beginner Help: Grid not loading data [Solved]

    Embarrassingly I found it almost straight away after posting.
    So for anyone else that reads this in future, JsonStore doesnt automatically load the data unless you add the option autoLoad: true

    Problem solved.

  3. #3

Similar Threads

  1. Loading Data into Grid
    By Jogilein in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 15 Apr 2010, 4:24 AM
  2. Loading Data To GRID
    By khskinsfan in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 9 Oct 2008, 5:16 AM
  3. Data is not loading in the grid
    By Hon in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 10 Jul 2008, 3:51 AM
  4. Getting Data from a jsp file - Beginner Question
    By ppolyzos in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 24 Oct 2007, 6:25 AM

Posting Permissions

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