PDA

View Full Version : Set margins for Ext.layout.BorderLayout.Region



traxanos
7 Oct 2010, 11:01 PM
Hi

i have a problem.



Demo = Ext.extend(Ext.Panel, {
border: true,
region: 'center',
margins: '5 5 5 5',
initComponent: function() {
Demo.superclass.initComponent.call(this);
}
});


The margins value will be ignored. How i should set the margins for the Ext.layout.BorderLayout.Region.

Animal
7 Oct 2010, 11:45 PM
Why are you extending?

Why aren't you just configuring a Panel with margins?

Condor
7 Oct 2010, 11:50 PM
I agree with Animal, but if you actually do have a good reason to create a new class then your problem is that you are not setting the initialConfig, e.g.

Demo = Ext.extend(Ext.Panel, {
initComponent: function() {
var cfg = {
border: true,
region: 'center',
margins: '5 5 5 5'
};
Ext.apply(this, cfg);
Ext.apply(this.initialConfig, cfg);
Demo.superclass.initComponent.call(this);
}
});

traxanos
8 Oct 2010, 12:00 AM
becsaue i need a base panel that i will use for most other panels.

@condor

thaks that works

Animal
8 Oct 2010, 12:35 AM
How many center regions are you planning to have?

traxanos
8 Oct 2010, 1:20 AM
every page i have, based on an App.BasePanel that have some default values (e.g. margins) and some events for loading mask.