PDA

View Full Version : Uncaught TypeError: Cannot read property 'length' of undefined



hermann.s
16 Aug 2013, 5:36 AM
Hi,

I have the following code which works perfectly fine :


Ext.onReady(function () {


var viewport = Ext.create('Ext.container.Viewport', {
layout: 'fit'
});


var panel = Ext.create('Ext.panel.Panel', {
width: @BFE.Frontend.Main.ApplicationMinWidth + @BFE.Frontend.Main.MenuWidth,
layout: 'border',
renderTo: Ext.getBody()
});


var mainTabPanel = Ext.create('Ext.panel.Panel', {
id: 'MainTabPanel',
title: 'BPCT',
minWidth: @BFE.Frontend.Main.ApplicationMinWidth,
region: 'center',
hideMode: 'offsets',
layout: 'card',
renderTo: Ext.getBody(),
listeners: {
afterRender: {
fn: function ()
{
this.header.add([{
xtype:'combobox',
width:150,
triggerCls:'x-form-search-trigger',
emptyText:'@BFE.Frontend.Main.SearchEmptyText'}
])
}
}
}
});


var menuPanel = Ext.create('Ext.tree.Panel', {
id: 'MenuPanel',
title: 'Main Menu',
region: 'west',
animate: false,
autoscroll: true,
collapsible: true,
collapseMode: 'header',
collapseDirection: 'left',
lines: false,
useArrows: true,
rootVisible: false,
frame: false,
width: @BFE.Frontend.Main.MenuWidth,
store: {
root: {
expanded: true,
text:"",
user:"",
status:"",
children: [
{ text:"Projects", leaf: true },
{ text:"Business Partner", leaf: true },
{ text:"Current Tasks", leaf: true },
{ text:"Closed Tasks", leaf: true },
{ text:"Search", leaf: true },
{ text:"Options",
children: [
{ text:"Delegation", leaf: true }
]
},
{ text:"Help", leaf: true }
]
}
},
renderTo: Ext.getBody()
});


var myTask = Ext.create('Ext.container.Container', {
id: '@BFE.Frontend.MyTask.Container',
layout: 'accordion',
hideMode: 'offsets'
});


viewport.add(panel);
panel.add(menuPanel);
panel.add(mainTabPanel);


});

Now... as soon as I add

var myTaskGrid = Ext.create('Ext.grid.GridPanel', {
id: 'test'
});


to my code, I get this :

Uncaught TypeError: Cannot read property 'length' of undefined ext-all-debug.js:103342

What's up with that? Any ideas?

tobiu
16 Aug 2013, 5:47 AM
are you not passing the mandatory configs store and columns to the grid?

hermann.s
16 Aug 2013, 5:50 AM
are you not passing the mandatory configs store and columns to the grid?

Thank you! That was the problem.