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?