Results 1 to 6 of 6

Thread: TabPanel events

  1. #1
    Sencha User
    Join Date
    Sep 2010
    Location
    Austria
    Posts
    59
    Vote Rating
    2
      0  

    Default TabPanel events

    Hi,
    which event is fired, if one tap ist clicked, in ST1 there was a click event?

    In ST2 i can`t find an event, which I can use in my controller to catch the tap event ???



    PHP Code:
    Ext.define('App.controller.Main',{    
    extend'Ext.app.Controller',
        
    // registriere die views    

    views: [        
      
    'Desk1'    
    ],    
    refs: [        
       {            
          
    ref'myTab',            
          
    selector'#myTab'        
       
    }    
    ],     

    init: function(){        
      
      if(
    _debug)console.log("Controller gestartet");

      
    this.control({

           
    '#myTab' : { show 'handleItemChange'}        
        });

        },
        
    handleItemChange: function(){        
             
    console.log("test");    
        }
    }); 

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      0  

    Default

    tap events are on the elements, not components.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3

  4. #4
    Sencha User
    Join Date
    Sep 2010
    Location
    Austria
    Posts
    59
    Vote Rating
    2
      0  

    Default

    Is the post below also the reason why my control function do`t catch the tap event ??


    PHP Code:
    this.control({
        
    '#myTab': { 
            
    tapthis.onKlick
        
    }
    }); 
    PHP Code:

    Ext
    .define('App.view.Desk1', {    
    extend'Ext.tab.Panel',    
    alias'widget.viewDesk1',    
    id'myTab',    
    config: {        
    fullscreentrue,        
    activeItem0,        
    tabBarPosition'bottom',        
    cardSwitchAnimation: {            
       
    type'slide',           
       
    covertrue        
    },        
    defaults: {            
    scrollable'vertical',            
    styleHtmlContenttrue        
    },        
    items: [            
    {
    title'B1'iconCls'info'id'tab1',html:'test 1'},            
    {
    title'B2'iconCls'user'id'tab2'html'test2'}        ]

        },    
    initialize: function(){        
    this.callParent();        
    this.element.on({           
       
    tap: function(){               
        var 
    activeTab Ext.getCmp("myTab").getActiveItem();
        if(
    _debug)console.dir(activeTab.title);
            
    console.log("klick in View");

            }        
        });    
      }

    }); 

  5. #5
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      0  

    Default

    this.control cannot listen to elements, just components. What I usually do is add the listener in my class definition in the initialize method and then fire that event on the component and then this.control can then listen for it.

    Code:
    initialize : function() {
        var me = this;
    
        me.callParent(arguments);
    
        me.element.on({
            scope : this,
            tap : 'bubbleTapEvent'
        });
    },
    
    bubbleTapEvent: function(e, t) {
        this.fireEvent('tap', this, e, t);
    }
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  6. #6
    Sencha User
    Join Date
    Sep 2010
    Location
    Austria
    Posts
    59
    Vote Rating
    2
      0  

    Default

    thanks man, it works now

Posting Permissions

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