PDA

View Full Version : Is it possible to open a new tab on the click of element in previous tab?



jaisonjames
11 Nov 2010, 9:09 PM
I have a tab content area with four window. I need to open another tab with some details onclick of each window or elements in window. Is it possible?

Thanks in advance somebody can give a solution.

Animal
11 Nov 2010, 10:52 PM
Add a new Component to the TabPanel in the click handler.

jaisonjames
11 Nov 2010, 10:58 PM
Please have a look below code.

Ext.onReady(function(){

// NOTE: This is an example showing simple state management. During development,
// it is generally best to disable state management as dynamically-generated ids
// can change across page loads, leading to unpredictable results. The developer
// should ensure that stable state ids are set for stateful components in real apps.
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

var viewport = new Ext.Viewport({
layout: 'border',
items: [
new Ext.TabPanel({
region: 'center', // a center region is ALWAYS required for border layout
deferredRender: false,
activeTab: 0, // first tab initially active
items: [{
contentEl: 'dashboard-panel',
title: '<b>CIO Command Center<b>',
autoScroll: true
},
{
contentEl: 'db-chart01-details',
title: 'Details Of My Chart01',
closable: true,
autoScroll: true
}]
})]
});


function addTab(){
tabs.add({
contentEl: 'db-chart01-details',
title: 'Details Of My Chart01',
closable: true,
autoScroll: true
}).show();
}

new Ext.Button({
text: 'Add Tab',
handler: addTab,
iconCls:'new-tab',
cls:'add-x-btn'
}).render(document.body);

});

Are we on right track?

Animal
11 Nov 2010, 11:49 PM
render?

What do the API docs of render tell you?