-
19 May 2012 3:55 AM #1
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:
Any ideas?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' }] } });
-
Best Answer Posted by mitchellsimoens
Try this selector:
The tab panel has a child tab bar and the tab bar has child tabs.Code:mytab tab
-
21 May 2012 6:03 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 436
- Answers
- 3108
Try this selector:
The tab panel has a child tab bar and the tab bar has child tabs.Code:mytab tab
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.
-
21 May 2012 8:15 AM #3
-
21 May 2012 8:46 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 436
- Answers
- 3108
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.
-
21 May 2012 9:02 AM #5
Thanks for that! I'm sure it will

-
1 Jun 2012 1:05 AM #6
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
-
1 Jun 2012 4:04 AM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 436
- Answers
- 3108
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.


Reply With Quote
