Created
April 24, 2009 09:47
-
-
Save TheNicholasNick/101040 to your computer and use it in GitHub Desktop.
ExtJS load radiogroup values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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