-
10 Feb 2012 11:22 AM #1
Unanswered: toggleGroup Listener?
Unanswered: toggleGroup Listener?
Is there a listener for a whole set of Buttons with a toggleGroup, or do I have to listen to each button?
View
Code:{ xtype: 'container', id: 'buttonGroupContainer', columnWidth: 0.52, items: [ { xtype: 'button', id: 'hrs0', text: '0', toggleGroup: 'forecastButtons', pressed: 'true' }, { xtype: 'button', id: 'hrs24', text: 24, toggleGroup: 'forecastButtons' }, { xtype: 'button', id: 'hrs48', text: 48, toggleGroup: 'forecastButtons' }, { xtype: 'button', id: 'hrs72', text: 72, toggleGroup: 'forecastButtons' } ] }
-
10 Feb 2012 11:32 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
- Answers
- 3109
If you aren't using MVC then you would have to listen in each button.
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.
-
10 Feb 2012 11:34 AM #3
I am using MVC. Here's my controller block. I just listen to all buttons at once, which catches two events. Is there a way to only catch one event for the whole group? A different selector maybe?
Code:init: function() { console.log('forecast init'); this.control({ '#buttonGroupContainer button': { toggle: this.forecastToggle } }) }, forecastToggle: function(btn, pressed) { if(pressed) { //fire event for btn id } }
-
10 Feb 2012 11:35 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
- Answers
- 3109
The based on the componentquery you should be able to have the listener listen for each button
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