PDA

View Full Version : activetab.show(); didn't work ?



softball
7 May 2014, 9:20 PM
Dear?Iuse the code as fellow?
but,
Q1. showAll() can active tha tab,
but in showActive()? activetab.show() didn't work....
Why?

Q2.In chgStyle()
how can I get the context of style ,and set or add some code ?
In my code ,those does nothing..

THX





<script>
Ext.onReady(function() {
var tp=Ext.create("Ext.TabPanel",{
title:"TEST",
width:300,
height:200,
style:"margin:10px;",
frame:true,
defaults:{bodyPadding:10},
buttons:[{text:"hide",handler:hideActive},
{text:"show",handler:showActive},
{text:"showAll",handler:showAll},
{text:"chgStyle",handler:chgStyle}
],
items:[
{title:"home",html:"home"},
{title:"counter",html:"counter"},
{title:"admin",html:"admmin"}
],
renderTo:Ext.getBody()
});

function hideActive() {
var activetab=tp.getActiveTab();
activetab.tab.hide();
activetab.hide();
}
function showActive() {
var activetab=tp.getActiveTab();
activetab.tab.show();
activetab.show(); //QQQ?
}
function showAll() {
for (var i=0; i<tp.items.length;i++){
tp.items.get(i).tab.show();
tp.items.get(i).show();
}
}

function chgStyle(){
Ext.MessageBox.alert("XX",tp.getStyles());
//tp.style="background-color:yellow;";
tp.setStyles("background-color:yellow;");
//background-color:yellow;
}

}); //end of onReady
</script>

praetor_blue
8 May 2014, 1:29 PM
Correct me if I am wrong, but an 'active' tab means it is not hidden, thus, .show() wont have any effect. You might be referring to setActive() or setActiveCard() method instead of show().

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.tab.Panel-method-setActiveTab

softball
8 May 2014, 9:52 PM
Sorry? I didn;t say it clearly.
when I hided the Hr tab,and show it, I can see the tab button show, but the tab content didn;t show.
so , I musy switch to another tab button, and switch back to HR button again, the it showed.

48956