gruu
18 Feb 2008, 6:50 AM
why is the grid allways empty? wht's wrong?
Ext.onReady(function() {
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'dades.php'}),
reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'totalCount',
id: 'id',
fields:['company','companyID']
})
});
var colModel = new Ext.grid.ColumnModel([
{header: "Company", width: 120, sortable: true, dataIndex:'company'},
{header: "ID", width: 90, sortable: true, dataIndex:'companyID'}
]);
var grid = new Ext.grid.GridPanel({ds:ds,cm:colModel});
grid.render("gridDiv");
ds.load({params:{start:0, limit:25}});
});
the response form "dades.php":
({"totalCount":"2","results":[{"companyID":"1","company":"Alcoa34"},{"companyID":"2","company":"General Electric Company"},]})
Ext.onReady(function() {
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'dades.php'}),
reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'totalCount',
id: 'id',
fields:['company','companyID']
})
});
var colModel = new Ext.grid.ColumnModel([
{header: "Company", width: 120, sortable: true, dataIndex:'company'},
{header: "ID", width: 90, sortable: true, dataIndex:'companyID'}
]);
var grid = new Ext.grid.GridPanel({ds:ds,cm:colModel});
grid.render("gridDiv");
ds.load({params:{start:0, limit:25}});
});
the response form "dades.php":
({"totalCount":"2","results":[{"companyID":"1","company":"Alcoa34"},{"companyID":"2","company":"General Electric Company"},]})