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>
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>