PDA

View Full Version : TabPanel and Anchor



sunco
12 Oct 2009, 12:49 PM
I want to create Tabs at 100% of width and height. I'm trying this but is not working



var tabs = new Ext.TabPanel({
renderTo:'AreaPrincipal',
defaults: {autoScroll:true},

autoWidth:true,
autoHeight: true,

plugins: new Ext.ux.TabCloseMenu()
});

function AgregarTab(valor) {
tabs.add({
title: 'New Tab - ' + valor,
iconCls: 'tabs',

layout:'anchor',
anchor: '100% 100%',

autoLoad: { url: valor, params: 'random=' + Math.random(), text:'<br><img src="images/cargando.gif" width="16" height="16" align="absmiddle"> Cargando...' },
closable:true }).show();
}



Somebody suggest to use ViewPort (on another thread) but i don't understand :">

sunco
13 Oct 2009, 9:16 AM
Answer myself



var viewport = new Ext.Viewport({
layout: 'border',
monitorResize: true,
renderTo: Ext.getBody(),
items: [
{ region: 'north', tbar: menu, height: 27 },
{ region: 'center', xtype: 'tabpanel', enableTabScroll:true, defaults: { autoScroll:true, layout:'fit' }, plugins: new Ext.ux.TabCloseMenu() }
]
});

function AgregarTab(titulo, url) {
var tabs = viewport.items.itemAt(1);

tabs.add({
title: titulo,
autoLoad: { url: url, scripts: true, params: 'random=' + Math.random(), text:'<br><img src="images/cargando.gif" width="16" height="16" align="absmiddle"> Cargando...' },
closable:true
}).show();

viewport.render();
}