Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check a radio button using ExtJS

I may be missing something, but how do I programmatically check a radiobutton using ExtJS (v 3)?

The following doesn't seem to always work

var radio = Ext.get("myradiobutton");

radio.set("checked,"");

The radio is sometimes checked, sometimes not...

radio.is(":checked") sometimes return true, sometimes false

Thanks

like image 601
David Avatar asked Feb 29 '12 08:02

David


3 Answers

I'd suggested using this function: http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.Radio-method-setValue

var radio = Ext.get("myradiobutton");
radio.setValue(true);
like image 56
Andrey Selitsky Avatar answered Oct 16 '22 18:10

Andrey Selitsky


Why not just use the DOM?

Ext.getDom('myradio').checked = true;
like image 28
Evan Trimboli Avatar answered Oct 16 '22 19:10

Evan Trimboli


For me it worked using the getCmp and setValue functions.

Ext.getCmp('yourid').setValue(true);
like image 38
Alexandre Neukirchen Avatar answered Oct 16 '22 17:10

Alexandre Neukirchen