PDA

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



softball
7 May 2014, 9:22 PM
Dear?In 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>

scottmartin
9 May 2014, 1:50 PM
Perhaps setActiveTab() is what you need?

softball
11 May 2014, 4:37 PM
Dear scottmartin (http://www.sencha.com/forum/member.php?165873-scottmartin):

thx for your help.
But? I had tried


function showActive() {
var activetab=tp.getActiveTab();
// Ext.MessageBox.alert("XX",activetab.getItemId());
activetab.tab.show();

//activetab.show(); //
tp.setActiveTab(activetab);

}

the tab button still show, that ok.
the tab content block still show? but no content show on block.
and the block is gray.

Unless , I switch to another tab button, and switch back again,the content block will show the content.