View Full Version : Add tab in app like ExtJS API

29 Dec 2010, 4:28 AM
Please give me advice.
I do the project looks like ExtJS API.

Please open EtxJS API http://dev.sencha.com/deploy/dev/docs/
You see there the tab "API Home".
In my project in this tab there are several links.
I need that if we click on one of them then new tab added. I do it in function like this

function link1MouseDown(event){
var p = MainPanel.add(new DocPanel({
id: 'link1-id',
cclass : 'jhjkhjkh',// I don't know fo what is that
autoLoad: '/welcome2.html',
iconCls: 'icon-link1'

But error occurs. It is said something like this:"MainPanel don't have method add".
Alltough in doc.js there is this code, that extends MainPanel with TabPanel

Ext.extend(MainPanel, Ext.TabPanel, {

Please give some idias how fix it.

29 Dec 2010, 4:35 AM
MainPanel is a class, you need to call add() in the INSTANCE of this class.

29 Dec 2010, 8:16 AM
But I don't know how to do it in the INSTANCE of this class, is another way?

29 Dec 2010, 8:19 AM
Does your MainPanel instance have an id? In that case you can use Ext.getCmp('id-of-mainpanel')

29 Dec 2010, 8:28 AM
Yes MainPanel has id:'doc-body',
Very thanks I will try.

29 Dec 2010, 8:32 AM
It works.
Very thanks Condor.
I understood what you mean about class.