1. #1
    Ext User
    Join Date
    Jun 2008
    Posts
    5
    Vote Rating
    0
    str2etboy is on a distinguished road

      0  

    Default Tabs activate listener - odd behavior

    Tabs activate listener - odd behavior


    Hi folks!

    This is my first post. I was searchg for a solution to my problem and the best thing I could come up with was quoted below. I want to add a new tab if you click on the first tab.

    HTML Code:
          <div id="tabPanelMessages">
                <div id="tabNew" class="x-hide-display"">A simple tab</div>
                <div id="tabInbox" class="x-hide-display">Another one</div>
                <div id="tabSent" class="x-hide-display">A simple tab</div>
                <div id="tabWall" class="x-hide-display">Another one</div>            
            </div>  
            <script>       
                Ext.onReady(function(){
                    var tabPanelMessages = new Ext.TabPanel({
                        renderTo: 'tabPanelMessages',
                        activeTab: 1,
                        items:[
                            {contentEl:'tabNew', title:'Compose', listeners: { activate: function(){ composeMessage(); } } },
                            {contentEl:'tabInbox', title:'Inbox'},
                            {contentEl:'tabSent', title:'Sent'},
                            {contentEl:'tabWall', title:'Wall'}
                        ]
                    });
                    var index = 1;
                    function composeMessage(){
                        tabPanelMessages.add({
                            title: 'New Message ('+index+')',
                            iconCls: 'tabs',
                            html: 'Tab Body ',
                            id: 'newMessage'+index,
                            closable: true
                        }).show();
                        tabPanelMessages.activate('newMessage'+index);
                        index++;
                    }                                       
                
                           
                })
            </script>
    If I click on the New Message tab I got 2 new tabs instead of 1.

  2. #2
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    Code:
                             var index = 1;
                    function composeMessage(tab){
                        var tab = tabPanelMessages.add({
                            title: 'New Message ('+index+')',
                            iconCls: 'tabs',
                            html: 'Tab Body ',
                            id: 'newMessage_' + (index++),
                            closable: true
                        });
                        
                        tabPanelMessages.doLayout(); //required for layout changes
                        tabPanelMessages.activate(tab);
                        
                      }
                    }
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar