PDA

View Full Version : flex problem - border layout ?



gfrancis1@gmail.com
5 Mar 2012, 8:41 PM
can anyone tell me why this script gives
'ext-all.js:15
Uncaught TypeError: Cannot read property 'flex' of undefined'

http://jsfiddle.net/blackfrancis75/63Bbr/ (http://jsfiddle.net/blackfrancis75/63Bbr/)

I think it's to do with the Border layout

tvanzoelen
6 Mar 2012, 1:50 AM
Working fine in 4.1[B2].

The only thing I can discover is that a borderlayout must have a center region.

gfrancis1@gmail.com
6 Mar 2012, 4:53 AM
So , does it mean there's a bug in Ext (4.07)?
As you can see, my Border layout does have a 'center' region

friend
6 Mar 2012, 4:54 AM
You can eliminate the extra panel and just set the Window to use a 'border' layout:



win = Ext.create('Ext.window.Window', {
closable : true,
defaults:{
padding: 8,
border: 0
},
height : 380,
layout: 'border',
modal : true,
width : 550,
plain : true,
resizable : false,
title:'Bundle Wizard',
items:[{
xtype: "label",
region: 'north',
html: "Welcome to the Bundle Wizard.<BR/><BR/><BR/> Do you have a bundle Product Code?"
},{
xtype: 'panel',
region: 'center'
}]
});

win.show();

tvanzoelen
6 Mar 2012, 4:56 AM
Here you have not...there are no items in that border. Possible it breaks on that.



{
xtype: 'panel',
region: 'center',
layout:'border'
}

gfrancis1@gmail.com
6 Mar 2012, 5:00 AM
thanks 'friend' but I can't do that - the idea here is that there will be more 'card' panels (because it's a Wizard)

gfrancis1@gmail.com
6 Mar 2012, 5:01 AM
thanks tvanzoelen; I'll look at that

tvanzoelen
6 Mar 2012, 5:01 AM
var BundleWizardPage1Form = Ext.extend(Ext.form.Panel, {
id: 'card-0',
layout:'border',
initComponent: function() {
items:[

{
xtype: "label",
region: 'north',
html: "Welcome to the Bundle Wizard.<BR/><BR/><BR/> Do you have a bundle Product Code?"
}
,
{
xtype: 'panel',
region: 'center'
//layout:'border' <-- comment that out
}
];
this.callParent();//<-- and use callParent
}
});

gfrancis1@gmail.com
6 Mar 2012, 5:29 AM
Hmm, even with those changes I get the flex error
http://jsfiddle.net/blackfrancis75/63Bbr/2/

gfrancis1@gmail.com
6 Mar 2012, 6:15 AM
same thing seems to work fine if I dont define a separate panel subclass??

http://jsfiddle.net/blackfrancis75/zRfbw/4/