PDA

View Full Version : conditional tab loading



johija
22 Apr 2014, 8:26 AM
Currently in our application we load tabs, in launch function.

var viewPort = Ext.create('Ext.container.Viewport', {
layout : 'fit',
items: [
Ext.create('Ext.tab.Panel', {
items: [
Ext.create('Tab 1', {title: ' Tab 1'}),
Ext.create('Tab 2', {title: ' Tab 2'}),
],

}),
]
});


In the Panel, can I create Tab 2 on conditional basis. Like a variable set to true, then only I need to create 'Tab 2'?

Zinnia
22 Apr 2014, 10:18 PM
Yes, you can add new tab conditionally , see the below example
http://docs.sencha.com/extjs/4.2.1/#!/example/tabs/tabs-adv.html

johija
23 Apr 2014, 2:23 PM
Thanks for your reply.

I set a global constant value based on the condition to be validated, and then marked the tabs hidden based on that