PDA

View Full Version : [SOLVED] Add columns of portlets dinamically



manuito
5 Feb 2010, 5:24 PM
I have this code:


Ext.onReady(function() {
Ext.QuickTips.init();

var viewport = new Ext.Viewport({
layout:'fit',
items:[{
xtype: 'grouptabpanel',
tabWidth: 160,
activeGroup: 0,
items: [{
mainItem: 1,
items: [optRaton,optConfigurar]
},{
..................
var optConfigurar={
xtype: 'portal',
title: 'Configurar Aula',
iconCls: 'x-icon-configuration',
tabTip: 'Configurar el Aula',
style: 'padding: 10px; ',
items:[column1,column2,column3,column4,column5]
};......................

And I want to add other column of portlet dinamically:


var column6={
columnWidth:.16,
style:'padding:10px 0 10px 10px',
items:[{
title: 'Equipo 6',
tools: tools,
html: '<div style="text-align:center;"></div>'
},{
title: 'Equipo 12',
tools: tools,
html: '<div style="text-align:center;"></div>'
}]
};

optConfigurar.add(5,column6);But dont work... :((
Help!!!

MiamiCoder
6 Feb 2010, 5:26 PM
Did you try calling doLayout() after add()?

manuito
7 Feb 2010, 5:02 AM
Opsss. Two errors:

optConfigurar.add(5,column5) is not a function

optConfigurar.doLayout is not a function

manuito
7 Feb 2010, 10:14 AM
Thanks MiamiCoder.
I have solved my problem with this link: http://www.extjs.com/forum/archive/index.php/t-64738.html

My code:


//add a id
var column6={
columnWidth:.16,
id:'col6',
............

// add a column
var opt = Ext.getCmp('optConfigurar');
opt.add(5, column6);
opt.doLayout();

//and add a portlet
var column = Ext.getCmp('col6');
column.add({
tools: tools,
title: 'check',
html: 'asfo'
});
column.doLayout();