Results 1 to 6 of 6

Thread: Ext.SegmentedButton > setPressedButtons doesn't trigger "toggle" event

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2904 in a recent build.
  1. #1

    Default Ext.SegmentedButton > setPressedButtons doesn't trigger "toggle" event

    Sencha Touch version tested:
    • Sencha Touch 2.0.1


    Browser versions tested against:
    • Chrome 18.0.1025


    Description:
    • When we call "setPressedButtons" on a SegmentedButton component, it doesn't trigger the "toggle" event. Since other components do it, like "setValue" triggering "change", I expected SegmentedButton to share the same behavior.


    Steps to reproduce the problem:
    Create a SegmentedButton with a number of items, connect an event handler to the "toggle" event and call "setPressedButtons" method on the component and note that the event is not fired.

    Thanks,
    Leonardo Braga

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    Default

    Thanks for the report

    Code:
    new Ext.Container({
        fullscreen : true,
        items      : [
            {
                xtype     : 'segmentedbutton',
                items     : [
                    {
                        text : 'Yes'
                    },
                    {
                        text : 'No'
                    }
                ],
                listeners : {
                    toggle : function() {
                        console.log('toggle');
                    }
                }
            },
            {
                xtype   : 'button',
                text    : 'Press Yes',
                handler : function(button) {
                    var container = button.up('container'),
                        seg       = container.down('segmentedbutton'),
                        yes       = seg.down('button[text=Yes]');
    
                    seg.setPressedButtons(yes);
                }
            }
        ]
    });
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,159

    Default

    Fixed for the next release. Thanks for the heads up.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  4. #4
    Sencha User
    Join Date
    Mar 2010
    Location
    New York City
    Posts
    7

    Default

    Quote Originally Posted by rdougan View Post
    Fixed for the next release. Thanks for the heads up.
    I don't plan to upgrade to the new version any time soon. Could you provide me with a patch for 2.1? Or at least provide some details regarding the fix so that I can try to implement it in my application? Thanks.

  5. #5
    Sencha User rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,159

    Default

    The fix should be in 2.1 already.

    If you need a direct patch, you will need to go through support. Just link them to this thread.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  6. #6
    Sencha User
    Join Date
    Sep 2011
    Posts
    118

    Default

    I monkeypatched my current code with this new SegmentedButton code, and I'm running into an issue with the fixed source.

    I have a view component that I'm listening to 'toggle' on, but also setting the toggled button with setPressedButtons on view initialization.

    This is causing an infinite loop in my code with the updated source...

    Is there any way to skip passing the toggle event, suppress it, or perhaps set pressed buttons another way that won't trigger the event?

    Right now I'm removing the listener, setting the status, then re-installing it. Seems like a huge pain.

Posting Permissions

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