PDA

View Full Version : Tab Panel refresh content of a tab



syl_via38
24 Jan 2012, 5:59 AM
Hello,

I have a tabpanel, and when I click on a menu I hava some tabs which appears.

I need to change the content (the item in fact) of a tab switch a variable session ($_SESSION['VARIABLE']). But, even if my variable change, the tabPanel always contain the same item.
Here is the definition of my tab :



tabPanel.add({
id : 'tabObsNov',
frame:false,
border:false,
autoShow:true,
closable: true,
closeAction:'destroy',
title: 'myTab',
items:[
{
border:false,
html: Ext.get('tabObsNovTxt').dom.innerHTML
},
{
border:false,
width:'55%',
margin:'10 0 0 200',
items:[<?Php
if($_SESSION['VARIABLE']=="on"){
echo "ObsNovForm" ;
}
else{
echo "ObsAdvForm";
}?>
]
}
]
}).show();


I tried to destroy the current tab with tab.destroy() and call a new one but always the same tab is opened and I don't understand why

Any Idea ?

Sylvia From Bordeaux (France)

jay@moduscreate.com
24 Jan 2012, 6:56 AM
My only guess is that the code that you're generating is static to the page instance that you've loaded. <shrugs>

syl_via38
24 Jan 2012, 6:59 AM
Well, Thanks for your answer. But I don't understand.

Do you have an idea to solve my problem ? I thought that if I destroy my tab and create a new one it can works but not ...

friend
24 Jan 2012, 9:06 AM
You must use tabPanel.remove(someComponent) to remove a 'tab' from the tabpanel.

jay@moduscreate.com
24 Jan 2012, 9:19 AM
Well, Thanks for your answer. But I don't understand.

Do you have an idea to solve my problem ? I thought that if I destroy my tab and create a new one it can works but not ...

Chances are the JavaScript that is automatically generated by the PHP code is static.

It's hard to really understand what your problem is. Language barriers are not cool!

syl_via38
25 Jan 2012, 7:20 AM
Well, I use your solution : tabPanel.remove() and it seems to work. Thanks a lot !

@jay : yes, sorry for my poor english, it's not very easy to explain technical issues with foreign language !