1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    62
    Vote Rating
    0
    Answers
    1
    stevanicus is on a distinguished road

      0  

    Default Answered: On tab icon tap

    Answered: On tab icon tap


    Something I have found incredibly difficult is to listen for tab icon taps in a controller. I have tried to the following selectors and more

    Controller:
    Code:
    control: {
                'mytab':{
                    tap:'onTabTap'
                },
                'mytab button[action=myHomeButton]':{
                    tap:'onTabTap'
                },
    
    
            }

    In the end I went for the actual tab change
    Code:
    'myhome':{
                    activate:'onTabTap'
                }

    My view:
    Code:
    Ext.define("BibleVerse.view.Main", {
        extend: 'Ext.tab.Panel',
        requires: ['Ext.TitleBar'],
        xtype:'mytab',
        
        config: {
            tabBarPosition: 'bottom',
            items: [{
                xtype:'myhome',
                action:'myHomeButton'
            },{
                xtype:'mysettings'
            }]
            
        }
    });
    Any ideas?

  2. Try this selector:

    Code:
    mytab tab
    The tab panel has a child tab bar and the tab bar has child tabs.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,656
    Vote Rating
    436
    Answers
    3108
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Try this selector:

    Code:
    mytab tab
    The tab panel has a child tab bar and the tab bar has child tabs.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    62
    Vote Rating
    0
    Answers
    1
    stevanicus is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Try this selector:

    Code:
    mytab tab
    The tab panel has a child tab bar and the tab bar has child tabs.
    Thanks for your response

    Still no luck

    Code:
    'mytab tab':{
                    tap:function(){alert('help')}
                }

    Update: sorry - my mistake didnt upload properly.. Thanks for that! Worked like a treat

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,656
    Vote Rating
    436
    Answers
    3108
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Just saw your update. Prepared a simple test case, maybe it will help others:

    Code:
    Ext.define('Test.controller.Main', {
        extend : 'Ext.app.Controller',
    
        config : {
            control : {
                'tabpanel tab' : {
                    tap : 'onTabTap'
                }
            }
        },
    
        onTabTap : function() {
            console.log('tap');
        }
    });
    
    Ext.application({
        name : 'Test',
    
        controllers : [ 'Main' ],
    
        launch : function () {
    
            new Ext.tab.Panel({
                fullscreen : true,
                items      : [
                    {
                        title : 'One'
                    },
                    {
                        title : 'Two'
                    }
                ]
            });
    
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    62
    Vote Rating
    0
    Answers
    1
    stevanicus is on a distinguished road

      0  

    Default


    Thanks for that! I'm sure it will

  7. #6
    Sencha User
    Join Date
    Apr 2012
    Posts
    68
    Vote Rating
    0
    mukeshgla is on a distinguished road

      0  

    Default


    hi Mitchell,

    As per your code whenever i click on any Tab One or Two "tap" is printed on console, but I want it to recognize the tabs tapped. i.e. I should be able to distinguished if tab one or Two is pressed?

    Thanks & Regards
    Mukesh pandey

  8. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,656
    Vote Rating
    436
    Answers
    3108
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    The tab instance is the first argument in the onTabTap method. Or you can change the control statement to be a different selector.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread