PDA

View Full Version : JSonStore & GridPanel



mpacheco
23 Jun 2010, 12:14 PM
Hi,

I'm trying to get a JSonStore working with a GridPanel and I cannot get it work :-?

This is the js code:


// JScript File
Ext.onReady(function(){

var dataStore = new Ext.data.JsonStore({
// store configs
autoDestroy: true,
url: 'Default.aspx',
storeId: 'dataStore',
// reader configs
root: 'main',
idProperty: 'id',
fields: [
'id',
'iobjectid',
'organismo',
'note'
'ref',
'type'
]
});

//grid definition
var grid = new Ext.grid.GridPanel({
title: 'MEP Notes',
height:500,
collapsible:true,
store: dataStore,
stripeRows: true,
animCollapse: true,
columnLines: true,
columns: [
{header: 'id', dataIndex: 'id', width: 100},
{header: 'iobjectid', dataIndex: 'iobjectid', width: 100},
{header: 'organismo', dataIndex: 'organismo_id', width: 100},
{header: 'note', dataIndex: 'note', width: 100},
{header: 'ref', dataIndex: 'ref', width: 100},
{header: 'type', dataIndex: 'type', width: 100},
]
});

//grid.store.load(dataStore);
grid.getStore().load();

grid.render('topic-grid');
});

this is the aspx Page code:



{'status':'OK','totalCount':'4''message':'','main':[{'id':'5786','iobjectid':'250006','organismo':'MEP','organismo_id':'1','note':'INSTALACIÓN DE TRAMPAS','ref':'EMITIDA','type':'0'}],'statusCode':'OK'}
The error I get is 'undefined' is null or not an object in ext-all.js and I don't know where to look at.

Any idea?

Thanks!

GoneIn20Seconds
23 Jun 2010, 1:03 PM
One problem might be that in your column model you are looking for the dataIndex "organismo_id" where in your store you have "organismo".

This error might also mean that you don't have an HTML tag with the id of "topic-grid" on your page.