PDA

View Full Version : not able to render render a grid



nishant.na.agnihotri
10 May 2013, 11:44 PM
Hi
I am trying to render a simple grid, but I do not understand what is going wrong.
Firefox gives an error in firebug console :
TypeError: this.addEvents is not a function
'statesave'


Please help me in sorting out my mistake.
Below is my code :

Ext.onReady(main);


function main(){
var myStore = new Ext.data.ArrayStore({
fields : [
{
name : 'accounts'
},
{
name : 'transitions'
}
]
});

var myData = [
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1'],
[ 'Account 1','Transition 1']
];
myStore.loadData(myData);

var myGrid = Ext.grid.GridPanel({
title : 'Grid',
store : myStore,
columns : [
{
id : 'accountsColumn',
header : 'Accounts',
width : 120,
dataIndex : 'accounts'

},
{
id : 'projectsColumn',
header : 'Accounts',
width : 120,
dataIndex : 'transitions'
}
],
stateful: true,
stateId: 'grid'
});

var win = new Ext.Window({
title : 'Sample',
shadow : false,
frame : true,
layout : 'fit',
items : [myGrid]
});
win.show();
}

mitchellsimoens
13 May 2013, 8:03 AM
You are missing the new keyword when creating the grid:


var myGrid = new Ext.grid.GridPanel({