1. #1
    Sencha User drumforhim's Avatar
    Join Date
    May 2011
    Location
    Greece
    Posts
    14
    Vote Rating
    0
    drumforhim is on a distinguished road

      0  

    Default Unanswered: Adding tabs from menu tree items

    Unanswered: Adding tabs from menu tree items


    Hello everyone.
    I have a problem with adding tabs to a tab panel when i click a menu item. Here is my code
    Code:
    var mainMenuTree = Ext.create('Ext.tree.Panel', {
        store: mainMenuTreeStore,
        rootVisible: false,
        border : false,
        bodyPadding : 5,
        listeners : {
            itemclick : function(view, record, item, index, evt, eOpts) {
                var text = record.get('text');
                var id = record.internalId;
                var leaf = record.data.leaf;
                if(leaf === true) {
                    var newTab = MainUITabPanel.add({
                        title : text,
                        id : id,
                        layout : 'fit',
                        items : [eval(id)],
                        closable : true,
                        border : false,
                        frame : false
                    });
                    MainUITabPanel.setActiveTab(newTab);        
                }        
            }
        }
    });
    My problem is that when i click again on the same menu item it adds the same tab to the tab panel. and if i click again it adds it for a third time. is there a config or property i have to enable either to the tab or tab panel!
    thank you

  2. #2
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    536
    Answers
    61
    Vote Rating
    70
    Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough

      0  

    Default


    Well you have an id on the tab when you add it. Instead of just checking for leaf you could also check if the tab already exists on the tabpanel using getComponent.
    http://docs.sencha.com/ext-js/4-1/#!...d-getComponent

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi