View Full Version : Dynamically Change ToggleGroup

23 Jan 2015, 8:51 AM
I have a set of toggle buttons and I want to change the togglegroup of this dynamically. It starts off with non togglegroup and this is changed to a different togglegroup.

Right now I'm doing the following:

btnOne.toggleGroup = 'newgroup';
btnTwo.toggleGroup = 'newgroup';

This isn't working so I'm sure there is something I'm missing.

Any ideas?

23 Jan 2015, 12:10 PM
Hi fily55--

Out of the box, there's no way to do this as the toggling is enabled (as well as the button getting added to the group) when the button is rendered and registered with Ext.button.Manager (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.button.Manager). You could look into registering the buttons yourself, but you'll want to take care to manage that so you're not duplicating registrations.

I hope that gives you a good place to start--thanks!

26 Jan 2015, 2:56 AM
Hi Joel, Thanks for your help, just what I needed. What I'm doing now is deregistering the button, set the toggle groups and then register them again. Seems to be working as expected. Thanks again!Fil