PDA

View Full Version : [FIXED] SegmentedButton Listener - Button Object undefined



peqper
27 Oct 2011, 1:04 AM
hi everyone,
i use the segmented-button example from the touch 2.0 documentation and noticed that the listener does not receive the button-object.

The console prints "User toggled the 'undefined' button: on".
Tested in Chrome & Safari on OSX.

With Touch 1.1.1 this example works without an error so i guess its a bug, or am i doing something wrong?




var segmentedButton = new Ext.SegmentedButton({
allowMultiple: true,
items: [
{
text: 'Option 1'
},
{
text : 'Option 2',
pressed: true },
{
text: 'Option 3'
}
],
listeners: {
toggle: function(container, button, pressed){
console.log("User toggled the '" + button.text + "' button: " + (pressed ? 'on' : 'off'));
}
}
});




edit:
calling button._text works

Jamie Avins
31 Oct 2011, 12:09 PM
Sounds like a bug in the event params, we will look into it, thank you for the report.

aarnau
30 Dec 2011, 10:01 AM
Are there news about this bug?

I cant detect what button is tapped.

Thanks.

Jamie Avins
3 Jan 2012, 9:35 AM
Are you still having the issue with PR3?

aarnau
5 Jan 2012, 8:32 AM
Yes, the console print undefined...

sven
5 Jan 2012, 9:54 AM
Instead of button.text you should use button.getText() or button.initialConfig.text depending on what you require.

aarnau
6 Jan 2012, 12:14 AM
with button.getText () works perfectly!!

thanks.