Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-2904
in
a recent build.
-
Sencha User
Ext.SegmentedButton > setPressedButtons doesn't trigger "toggle" event
Sencha Touch version tested:
Browser versions tested against:
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
-
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);
}
}
]
});
-
Sencha User
Fixed for the next release. Thanks for the heads up.
-
Sencha User

Originally Posted by
rdougan
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.
-
Sencha User
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 User
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.