Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #11
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    It seems to be strange but in fact it is not. It is because you do the creating new tab basing on the 'activate' event of a tab (Tab2 in your case) and this event happens not only by clicking on tab. It can happen when you close a tab because tabpanel will find and activate one of the remaining tabs and this will cause the 'activate' event happen.

    Hope you understand what I mean.

    P/S: Try to put your code inside the CODE tag then you will get more opportunity of getting support from the community.

  2. #12
    Sencha User
    Join Date
    Dec 2011
    Posts
    64
    Vote Rating
    0
    wasima is on a distinguished road

      0  

    Default


    thanks vietits. i understood ur point .which listener should be used in place of 'activate' listener then?

  3. #13
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    You should change Tab2 by using a button instead because your Tab2 just plays a role of button

  4. #14
    Sencha User
    Join Date
    Dec 2011
    Posts
    64
    Vote Rating
    0
    wasima is on a distinguished road

      0  

    Default


    thanks vietits,

    but by using a button i may not be able to place it as in order tab1 button ,click on button i get tab1 tab2 button as order, using a button means either placing it outside tab panel or inside a tab not as a tab header right ? i need to replicate a browser type behaviour(where i click on right most tab/button and a new tab opens .)

  5. #15
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Try this
    Code:
    Ext.onReady(function(){
        var tab = Ext.create('Ext.tab.Panel', {
            renderTo : Ext.getBody(),
            width: 300,
            height: 200,
            id: 'tabpanel',
            activeTab: 0,
            items: [{
                title: 'Tab 1',
                bodyPadding: 10,
                closable: true,
                html : 'A simple tab',
                id: 'tab1'
            }],
            listeners: {
                render: function(tabs){
                    tabs.getTabBar().add({
                        xtype: 'button',
                        text: '+',
                        handler: function(){
                            var tab = tabs.add({
                                title: 'Tab',
                                closable: true,
                                html: 'New tab'
                            });
                            tabs.setActiveTab(tab);
                        }
                    });
                }           
            }
        });
    });

  6. #16
    Sencha User
    Join Date
    Dec 2011
    Posts
    64
    Vote Rating
    0
    wasima is on a distinguished road

      0  

    Default


    Thanks vietits .that works fine , a minor enhancement i required was , default there is tab1 and + button, on click of + button twice the order of buttons is normal ie tab1 tab2 tab3 + button , but when i close tab3 , tab2 should be activated but in above solution tab1 is getting activated so i tried modifying code a bit shown in red but found no success .

    Code:
    Ext.onReady(function(){
        var tab = Ext.create('Ext.tab.Panel', {
            renderTo : Ext.getBody(),
            width: 300,
            height: 200,
            id: 'tabpanel',
            activeTab: 0,
            items: [{
                title: 'Tab 1',
                bodyPadding: 10,
                closable: true,
                html : 'A simple tab',
                id: 'tab1'
            }],
            listeners: {
                render: function(tabs){
                    tabs.getTabBar().add({
                        xtype: 'button',
                        text: '+',
                        handler: function(){
                            var tab = tabs.add({
                                title: 'Tab'+ (tabs.items.length + 1),
                                closable: true,
                                html: 'New tab',
                                listeners : {
                                    close: function () {
                                         var len = tabs.items.length-1;
                                         tabs.setActiveTab(len);
                                    }
                                }
    
    
                            });
                            tabs.setActiveTab(tab);
                        }
                    });
                }
            }
        });
    });

  7. #17
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Let walk thru what happens when you close a tab:
    1. Determine the tab will be set active. The priority of finding will be:
    - The previous active tab.
    - The tab next to the closing tab.
    - The tab previous the closing tab.
    2. Fire 'close' event on the closing tab.
    3. Set active tab to the tab determined in step 1.
    So setting active tab that you've done in the close event handler will be overrided by setting active tab that's done by the framework in step 3.
    However, if you still want tabpanel behaves as you mentioned, you should delay the action of setting active tab in the close event handler to make sure it will happen after the framework has done step 3.
    Code:
    Ext.onReady(function(){
        var tab = Ext.create('Ext.tab.Panel', {
            renderTo : Ext.getBody(),
            width: 300,
            height: 200,
            id: 'tabpanel',
            activeTab: 0,
            items: [{
                title: 'Tab 1',
                bodyPadding: 10,
                closable: true,
                html : 'A simple tab',
                id: 'tab1'
            }],
            listeners: {
                render: function(tabs){
                    tabs.getTabBar().add({
                        xtype: 'button',
                        text: '+',
                        handler: function(){
                            var tab = tabs.add({
                                title: 'Tab'+ (tabs.items.length + 1),
                                closable: true,
                                html: 'New tab',
                                listeners : {
                                    close: function () {
                                        Ext.defer(function(){
                                            var len = tabs.items.length-1;
                                            tabs.setActiveTab(len);
                                        }, 1);
                                    }
                                }
                            });
                            tabs.setActiveTab(tab);
                        }
                    });
                }
            }
        });
    });

  8. #18
    Sencha User
    Join Date
    Dec 2011
    Posts
    64
    Vote Rating
    0
    wasima is on a distinguished road

      0  

    Default


    thanks vietits, a minor concern ,
    At start , i have tab1 and + button , i click on + button twice i get tabs in order tab1 tab2 tab3 + button , now i am in tab1 , and i close tab3 , in normal browser behaviour the active tab now should be tab1 itself , but by this solution it sets active tab to tab2.

  9. #19
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Code:
    Ext.onReady(function(){
        var tab = Ext.create('Ext.tab.Panel', {
            renderTo : Ext.getBody(),
            width: 300,
            height: 200,
            id: 'tabpanel',
            activeTab: 0,
            items: [{
                title: 'Tab 1',
                bodyPadding: 10,
                closable: true,
                html : 'A simple tab',
                id: 'tab1'
            }],
            listeners: {
                render: function(tabs){
                    tabs.getTabBar().add({
                        xtype: 'button',
                        text: '+',
                        handler: function(){
                            var tab = tabs.add({
                                title: 'Tab'+ (tabs.items.length + 1),
                                closable: true,
                                html: 'New tab',
                                listeners : {
                                    close: function (tab) {
                                        if(tab.active){ // only do setting active tab if closed tab is active
                                            Ext.defer(function(){
                                                var len = tabs.items.length-1;
                                                tabs.setActiveTab(len);
                                            }, 1);
                                        }
                                    }
                                }
                            });
                            tabs.setActiveTab(tab);
                        }
                    });
                }
            }
        });
    });

  10. #20
    Sencha User
    Join Date
    Dec 2011
    Posts
    64
    Vote Rating
    0
    wasima is on a distinguished road

      0  

    Default


    thanks vietits ,
    but by this solution issue in post #16 repeats ie
    default there is tab1 and + button, on click of + button twice the order of buttons is normal ie tab1 tab2 tab3 + button , but when i close tab3 , tab2 should be activated but in above solution tab1 is getting activated .

Thread Participants: 1