PDA

View Full Version : close then add tab problem



mnask79
16 Oct 2009, 10:36 AM
hi All ,

i have the following script



function addTab(fullname,accNo,status){

if(Ext.getCmp('customer-detail-tab')){

tabP.setTitle(fullname +' ( account # '+accNo +' - status:'+ status +')');
tabs2.setActiveTab(tabP);
}else{

tabP = new Ext.TabPanel({
activeTab: 0,
id: 'customer-detail-tab',
title: fullname +' ( account # '+accNo +' - status:'+ status +')',
tabTip: fullname +' ( account # '+accNo +' - status:'+ status +')',
closable:true,
items:[grid2,grid,grid3,grid4,grid5,grid6]
});
tabs2.add(tabP);
tabs2.setActiveTab(tabP);
}

}


my problem is , when i close the tab by (close icon ) then add new tabpanel again , i cant select any tab inside thew tabpanel

what is the problem in my script ?
what shall i do to fix this problem ?

hendricd
16 Oct 2009, 11:18 AM
@mnask79- -- You've got global references to old components: See inlines:



function addTab(fullname,accNo,status){

var tabP = Ext.getCmp('customer-detail-tab');
if(!tabP){
tabP = tabs2.add(
new Ext.TabPanel({
activeTab: 0,
id: 'customer-detail-tab',
title: fullname +' ( account # '+accNo +' - status:'+ status +')',
tabTip: fullname +' ( account # '+accNo +' - status:'+ status +')',
closable:true,
items:[grid2,grid,grid3,grid4,grid5,grid6] //these are all destroyed when the tab is closed!!
})
);
tabs2.doLayout();
}
tabs2.setActiveTab(tabP);
}
Think thru this a bit more.
Is this a tabPanel of tabPanels?

You will have to create all new grids too. :-?

mnask79
16 Oct 2009, 11:32 AM
logic i'm thinking to do is , i don't want to re create grid's again , i just want to reload the store's when i select another customer , so i Reset the tab title , then i will reload the stores for all grid based on selected customer , and i suppose end user don't want to see the customer tab so maybe he close it , then maybe he need to re-open the tab for new customer
so please can u help me , or give me a good logic

mnask79
16 Oct 2009, 11:37 AM
yes , this is tab panel of tab panel

this is the main one



var tabs2 = new Ext.TabPanel({
activeTab: 0,

region:'center',
plain:true ,
width:600,
height:250,
items:[customers_grid]
});

var customers_MainePanel = new Ext.Panel({
title : 'Manage Customers' ,
layout: 'border',
region:'center',
height:475,
width : 1259 ,
id:'center_cont',
margins: '0 0 0 0',
items: [customers_serch_form, tabs2]
});


and when i select a customer , i open new tab contain tabpanel for all customer informations

if i do something wrong ,, please correct me

hendricd
16 Oct 2009, 11:47 AM
You really want to render a new tabPanel with 6 grids everytime a customer is selected in another grid? Yikes!

mnask79
16 Oct 2009, 11:53 AM
what is ur suggestions ?

and suppose yes i want to render , what shall i do ?

mnask79
16 Oct 2009, 11:59 AM
anyway , i dont plan to render all 6 grid's , what i plan to do is to load grid data when user click on grid tab



listeners: {activate: loadThisGridData},


and please tell me ur suggestions to avoid this

hendricd
16 Oct 2009, 12:00 PM
Depends on your requirements?
How many rows is each grid (6x) going to contain?
Are they actually going to look at one or two of the tabs(grids)?

These are all important design decisions. Think about all that (only you can). ;)

mnask79
16 Oct 2009, 12:05 PM
man , not all tabs contain grid , but i just making layout , but now , can u help me in my main problem ? when i close the tab that contain the tabpanel , then re-add anothe tab panel , the tabs dont work
please help me its very important for me :(