Results 1 to 4 of 4

Thread: toggleGroup Listener?

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    24
    Answers
    1
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,416
    Answers
    3899
    Vote Rating
    1269
      0  

    Default

    If you aren't using MVC then you would have to listen in each button.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
    Answers
    1
    Vote Rating
    0
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,416
    Answers
    3899
    Vote Rating
    1269
      0  

    Default

    The based on the componentquery you should be able to have the listener listen for each button
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

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