PDA

View Full Version : Uncaught TypeError: Object [object Object] has no method 'onAdded' -BorderLayout



Naresh_Reddy
21 Oct 2014, 12:27 PM
Hi
I am using ExtJs MVC Architecture.
when i am trying to add Border layout in my Viewport.js file i am getting following error
Uncaught TypeError: Object [object Object] has no method 'onAdded'

app/view/Viewport.js ::
Ext.define('Ext4Example.view.Viewport', {
extend: 'Ext.Viewport',
layout: 'fit',
requires: [
'Ext4Example.view.stock.StockBorder'
],
initComponent: function() {
var me = this;
Ext.apply(me, {
items: [
{
xtype: 'stockborder'
}
]
});
me.callParent(arguments);
}
});

view/stock/StockBorder.js:

Ext.define('Ext4Example.view.stock.StockBorder',{
extend:'Ext.layout.container.Border',
alias:'widget.stockborder',
frame: true,
title: 'Company Data',
bodyPadding: 5,
layout:'border',
defaults: {
collapsible: true,
split: true,
bodyStyle: 'padding:15px'
},
items: [{
title: 'Footer',
region: 'south',
height: 150,
minSize: 75,
maxSize: 250,
cmargins: '5 0 0 0'
},{
title: 'Navigation',
region:'west',
margins: '5 0 0 0',
cmargins: '5 5 0 0',
width: 175,
minSize: 100,
maxSize: 250
},{
title: 'Main Content',
collapsible: false,
region:'center',
margins: '5 0 0 0'
}]
});

app.js:
Ext.application({
name: 'Ext4Example',
controllers: [
'Stocks'
],
autoCreateViewport: true
});

carol.ext
22 Oct 2014, 12:28 PM
Looks like you are extending a layout class instead if some kind of container. If you change that to something like a Container or Panel depending upon your needs that error should go away.

Ext.define('Ext4Example.view.stock.StockBorder',{
extend:'Ext.layout.container.Border',
alias:'widget.stockborder',

Naresh_Reddy
22 Oct 2014, 6:19 PM
Thanks Carol, I made changes to my Design structure now i am able to use border lay out.In the viewport i used Panel structure from there implemented Border layout.
Thanks
Naresh