views:

566

answers:

2

How to manually change selected radio item in "Radio Options" menu? http://www.extjs.com/deploy/dev/examples/menu/menus.js Don't pay attention on id absent (for menu), I just want to know which method should be use.

I tried setActiveItem but it didn't work.

Thanks

A: 

I might misunderstand your question, but what about using the method

setValue( value {String/Boolean} ) : Ext.form.Field

"Sets either the checked/unchecked status of this Radio, or, if a string value is passed, checks a sibling Radio of the same name whose value is the value specified."

I would think that the radio group would make sure that the already checked button would be unchecked.

Chau
A: 

Hi,

finally I found a solution:

Ext.getCmp("our_id").menu.items.get(index).setChecked(true, true);

I found that this method has some issues, for example, setChecked works fine from firebug (only needed item checked), but if it run from javascript file, it doesn't work like radiobutton, but like checkbox. For this case, you should run across all items and explicitly checked and unchecked them.

Also be sure, to suppress emit signal (second parameter in setChecked method), to avoid recursion.

Alex Ivasyuv