David
David

Reputation: 34435

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

Upvotes: 5

Views: 23021

Answers (3)

Alexandre Neukirchen
Alexandre Neukirchen

Reputation: 2783

For me it worked using the getCmp and setValue functions.

Ext.getCmp('yourid').setValue(true);

Upvotes: 1

Andrey Selitsky
Andrey Selitsky

Reputation: 2604

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);

Upvotes: 13

Evan Trimboli
Evan Trimboli

Reputation: 30082

Why not just use the DOM?

Ext.getDom('myradio').checked = true;

Upvotes: 6

Related Questions