View Full Version : Better way to set state for radio button?

11 Mar 2010, 7:43 AM
Hi there, I am trying to find a better way to set the state for a radio button group. The scenario is that my user will make a choice for screen resolution (wide, narrow) and I'll store that choice in a cookie and use it to dynamically render the panel width when the appl is started.

I tried various combination's of the 'stateful', and 'stateId' configuration options but I couldn't get them to work. I was hoping that those options would let the radio button group automatically set its value option, but no luck.

The solution I came up with works ,but is there a better method?

Right now I have a listener for the radiogroup:

listeners: {
change : function(me, isChecked) {
// set cookie to screen size
Ext.state.Manager.set("screensize", isChecked.inputValue);
}and in the Ext.onReady, I use:

// initialize account parameters from state
var screensize = Ext.state.Manager.get("screensize");
if ((!(screensize)) || (screensize == 'wide') ) {
} else {
}Is there a better way?

12 Mar 2010, 4:56 PM
Any ideas??