I am newbie in Sencha Touch and I have a "segmentedButton" component, and I need to get the button pressed depending the user interaction in the controller.
Help please!!
You can use the getPressedButtons()
method.
Example:
Ext.application({
name : 'Fiddle',
launch : function() {
var segmentedButton = Ext.create('Ext.SegmentedButton', {
allowMultiple: true,
items: [{
text: 'Option 1'
},{
text: 'Option 2',
pressed: true
},{
text: 'Option 3'
}],
listeners: {
toggle: function(container, button, pressed){
alert("User toggled the '" + button.getText() + "' button: " + (pressed ? 'on' : 'off'));
console.log(container.getPressedButtons());
}
}
});
Ext.Viewport.add({ xtype: 'container', padding: 10, items: [segmentedButton] });
}
});
If anyone is looking for the same for Ext Classic here is the solution.
To get the values use container.getValue()
.
To set the values use container.setValue()
.
Fiddle is here