PDA

View Full Version : item is undefined



rushi2440
14 Feb 2012, 10:38 PM
HI.. forum member I am getting the item is undefined error when I am trying to bind the Ext.grid.Panel to Ext.panel.Panel.

I am having one panel with layout as border. In which on east I am adding the form input window and on the center I am adding the grid panel, but I am getting item is undefined error

my MainPanel code is below

Ext.define('projectmgt.view.project.projectMain', {
extend: 'Ext.panel.Panel',
requires: ['projectmgt.view.project.projectAdd','projectmgt.view.project.projectList'],
alias: 'widget.projectmain',
frame: true,
layout: {
type: 'border'
},
collapsed: false,
initComponent: function() {
var me = this;


Ext.applyIf(me, {
items: [
{
xtype: 'projectadd',
height: '100%',
width: 150,
flex: 1,
region: 'east'
},
{
xtype: 'projectgridlist',
height: '100%',
flex: 2,
region: 'center'
}
]
});


me.callParent(arguments);
}
});


and my projectgridlist code is below

Ext.define('projectmgt.view.project.projectList', {
extend: 'Ext.grid.Panel',
alias: 'widget.projectgridlist',
title: 'Project List',
itemId: 'projectList',
autoScroll: true,
preventHeader: true,
title: 'Project List',
forceFit: true,
store: 'projectStore',
columnLines: true,


initComponent: function() {
var me = this;


Ext.applyIf(me, {
dockedItems: [
{
xtype: 'toolbar',
dock: 'top'
},
{
xtype: 'pagingtoolbar',
displayInfo: true,
store: 'projectStore',
dock: 'bottom'
}
],
viewConfig: {


},
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'projecttitle',
text: 'Projecttitle'
},
{
xtype: 'gridcolumn',
dataIndex: 'projectname',
text: 'Projectname'
},
{
xtype: 'gridcolumn',
dataIndex: 'startdate',
text: 'Startdate'
},
{
xtype: 'gridcolumn',
dataIndex: 'enddate',
text: 'Enddate'
}
]
});


me.callParent(arguments);
}
});


my projectStore is below

Ext.define('projectmgt.store.projectStore', {
extend: 'Ext.data.Store',
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
storeId: 'projectStore',
proxy: {
type: 'ajax',
url: 'http://localhost:8085/ProjectManagementSystem/project/GetProject.action',
reader: {
type: 'json',
root: 'projectdata'
}
},
fields: [
{
name: 'projecttitle'
},
{
name: 'projectname'
},
{
name: 'startdate'
},
{
name: 'enddate'
}
]
}, cfg)]);
}
});


from my side I am doing things perfectly but not able to find out where the actual problem is . Help me to find the error and solved it soon. I just want to render the projectgridlist ‚Äčto my mainPanel.

Yogendra Singh
Sr. Programmer
Kintudesigns.com

mitchellsimoens
15 Feb 2012, 5:49 AM
What version of Ext JS 4 are you using? I just tried it with 4.1.0b2 and it worked fine for me. I had to remove the east region as I don't have that component. Also, the height and flex configs of the center and east region is unneeded.