Results 1 to 3 of 3

Thread: activetab.show(); didn't work

  1. #1
    Sencha User
    Join Date
    Apr 2014
    Posts
    44
    Answers
    1

    Default activetab.show(); didn't work

    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

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

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716

    Default

    Perhaps setActiveTab() is what you need?

  3. #3
    Sencha User
    Join Date
    Apr 2014
    Posts
    44
    Answers
    1

    Default

    Dear scottmartin:

    thx for your help.
    But? I had tried
    Code:
     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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •