1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    24
    Vote Rating
    0
    Answers
    1
    the_skua is on a distinguished road

      0  

    Default 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'
    		}
    	]
    }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If you aren't using MVC then you would have to listen in each button.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    24
    Vote Rating
    0
    Answers
    1
    the_skua is on a distinguished road

      0  

    Default


    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
            }
        }

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

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

Thread Participants: 1

Tags for this Thread