Skip to content

Instantly share code, notes, and snippets.

@TheNicholasNick
Created April 24, 2009 09:47
Show Gist options
  • Save TheNicholasNick/101040 to your computer and use it in GitHub Desktop.
Save TheNicholasNick/101040 to your computer and use it in GitHub Desktop.
ExtJS load radiogroup values
new Ext.form.FormPanel({
items: [{
xtype: "radiogroup"
,fieldLabel: "Gender"
,allowBlank: false
,items: [{
boxLabel: "Yes"
,name: "person-gender_rb"
,id: "person-gender_rb-true"
,inputValue: "true"
},{
boxLabel: "No"
,name: "person-gender_rb"
,id: "person-gender_rb-false"
,inputValue: "false"
}
]
}
]
,listeners: {
afterLayout: function() {
this.load({
url: "/data.json"
,method: "GET"
,params: {
response_format: "extjs_form_load"
}
,success: function(form, action) {
// This is what selects the correct option in the radio group
for(item in action.result.data) {
if(item.match(/_rb$/)) {
Ext.getCmp(item + "-" + action.result.data[item]).setValue(true);
}
}
}
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment