PDA

View Full Version : Add items on the fly to a tab panel with a form layout



Topper
26 Oct 2007, 6:11 AM
Hello. I have a form with a tab panel with a form layout with just one item like:



},{
id:'filesTab',
title:'Files',
layout:'form',
defaultType: 'textfield',
items:[ new Ext.form.Hidden({
name:'files',
value:''
})],
tbar: [fileAddAction]
},{



Later, in another function, I'm trying to access this panel items and add some other items dinamically. Although I am able to get the tab panel with



var filesTab = Ext.get('filesTab');


I can't access to the form methods to add items. The only thing I can do is add stuff via dom like:



filesTab.createChild({tag:'span',style:'font-size:10pt;font-family:Arial',id:'myspan'});


Shouldn't I be able to call some methods like filesTab.add() and stuff? Or should I access the tab's formPanel?

Regards
Topper

devnull
29 Oct 2007, 7:56 AM
you want:


var filesTab = Ext.getCmp('filesTab');

so that you get the actual Ext component, instead of just a dom node.