anton.dimitrov
16 Jan 2012, 6:29 AM
In the following example you can observe how a window is rendered to, and constrained to a tab panel within viewport.
Unfortunately, When `renderTo` is used some strange abnormal activity is observed with the window positioning. If we change the position of the window, then the 'constrain property' is applied (i suppose) with the X and Y coordinates of the viewport rather than the tab. This results in rendering the window.
Howeer, if we use 'constrainTo', the window is constrained properly, but not rendered within the tab.
To reproduce, just go to : http://localhost/ext-4.1.0-beta-1/docs/index.html#!/api/Ext.container.Viewport (http://localhost/ext-4.1.0-beta-1/docs/index.html#%21/api/Ext.container.Viewport) (there are no online beta docs so you will have to test on localhost)
and change the 'live example' code with this one :
Ext.create('Ext.container.Viewport', {
layout: 'border',
items: [{
region: 'north',
html: '<h1 class="x-panel-header">Page Title</h1>',
autoHeight: true,
border: false,
margins: '0 0 5 0'
}, {
region: 'west',
collapsible: true,
title: 'Navigation',
width: 150
// could use a TreePanel or AccordionLayout for navigational items
}, {
region: 'south',
title: 'South Panel',
collapsible: true,
html: 'Information goes here',
split: true,
height: 100,
minHeight: 100
}, {
region: 'east',
title: 'East Panel',
collapsible: true,
split: true,
width: 150
}, {
region: 'center',
xtype: 'tabpanel', // TabPanel itself has no title
activeTab: 0, // First tab active by default
items: {
title: 'Default Tab',
html: 'The first tab\'s content. Others may be added dynamically',
listeners: {
afterrender: function (tab){
Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
layout: 'fit',
constrain: true,
renderTo: tab.getEl(),
items: { // Let's put an empty grid in just to illustrate fit layout
xtype: 'grid',
border: false,
columns: [{header: 'World'}], // One header just for show. There's no data,
store: Ext.create('Ext.data.ArrayStore', {}) // A dummy empty data store
}
}).show();
}
}
}
}]
});
Unfortunately, When `renderTo` is used some strange abnormal activity is observed with the window positioning. If we change the position of the window, then the 'constrain property' is applied (i suppose) with the X and Y coordinates of the viewport rather than the tab. This results in rendering the window.
Howeer, if we use 'constrainTo', the window is constrained properly, but not rendered within the tab.
To reproduce, just go to : http://localhost/ext-4.1.0-beta-1/docs/index.html#!/api/Ext.container.Viewport (http://localhost/ext-4.1.0-beta-1/docs/index.html#%21/api/Ext.container.Viewport) (there are no online beta docs so you will have to test on localhost)
and change the 'live example' code with this one :
Ext.create('Ext.container.Viewport', {
layout: 'border',
items: [{
region: 'north',
html: '<h1 class="x-panel-header">Page Title</h1>',
autoHeight: true,
border: false,
margins: '0 0 5 0'
}, {
region: 'west',
collapsible: true,
title: 'Navigation',
width: 150
// could use a TreePanel or AccordionLayout for navigational items
}, {
region: 'south',
title: 'South Panel',
collapsible: true,
html: 'Information goes here',
split: true,
height: 100,
minHeight: 100
}, {
region: 'east',
title: 'East Panel',
collapsible: true,
split: true,
width: 150
}, {
region: 'center',
xtype: 'tabpanel', // TabPanel itself has no title
activeTab: 0, // First tab active by default
items: {
title: 'Default Tab',
html: 'The first tab\'s content. Others may be added dynamically',
listeners: {
afterrender: function (tab){
Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
layout: 'fit',
constrain: true,
renderTo: tab.getEl(),
items: { // Let's put an empty grid in just to illustrate fit layout
xtype: 'grid',
border: false,
columns: [{header: 'World'}], // One header just for show. There's no data,
store: Ext.create('Ext.data.ArrayStore', {}) // A dummy empty data store
}
}).show();
}
}
}
}]
});