View Full Version : Beginner Help: Grid not loading data

15 Jun 2010, 11:15 AM
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:

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?

15 Jun 2010, 11:20 AM
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.

16 Jun 2010, 6:23 PM
Eh, it's a learning experience ;)