PDA

View Full Version : BasicDialog



stever
3 Oct 2007, 6:14 AM
Since there is no BasicDialog in Ext2, I started by using this while updating our code. It is barebones at the moment, but hopefully someone else can help fill it in...




Ext.BasicDialogTabs = Ext.extend(Ext.TabPanel,{
defaults:{bodyStyle:'padding:18px;'},

readTabs : function(removeExisting)
{
if(removeExisting === true){
this.items.each(function(item){
this.remove(item);
}, this);
}
var tabs = this.el.query(this.autoTabSelector);
for(var i = 0, len = tabs.length; i < len; i++){
var tab = tabs[i];
var title = tab.getAttribute('title');
tab.removeAttribute('title');
var id = tab.getAttribute('id')+'_tab';
this.add({
id: id,
title: title,
contentEl: tab
});
}
},
hideTab: function(id)
{
this.hideTabStripItem(id+'_tab');
},
unhideTab: function(id)
{
this.unhideTabStripItem(id+'_tab');
},
enableTab: function(id)
{
this.getTab(id).disable(false);
},
disableTab: function(id)
{
this.getTab(id).disable();
},
activateTab: function(id)
{
this.setActiveTab(id+'_tab');
},
getTab:function(id)
{
return this.items.get(id+'_tab');
}

});

Ext.BasicDialog = Ext.extend(Ext.Window,{
closeAction: 'hide',
hideBorders: true,
bodyStyle:'padding-top:10px',
initComponent : function()
{
if (this.autoTabs)
{
this.tabs=new Ext.BasicDialogTabs({
deferredRender: false,
autoTabs: this.autoTabs,
activeTab:0,
el:this.tabsEl
});
this.items=[this.tabs];
this.layout='fit';
}
Ext.BasicDialog.superclass.initComponent.call(this);
},

getTabs:function()
{
return this.tabs;
},
getTab:function(id)
{
return this.tabs.getTab(id);
}
});

jack.slocum
4 Oct 2007, 2:11 AM
Thanks Steve. That will be really useful for many people who are upgrading!

litumishra
9 Sep 2008, 5:01 AM
Can you give any example, how to use this? I am new to Extjs.

Thanks

stever
23 Sep 2008, 10:53 AM
Can you give any example, how to use this? I am new to Extjs.

Thanks

It is not for you then. It is a class to help people port from Ext 1.x to Ext 2.x