loadRecord()
code:
Ext.define("UserModel", {
extend: 'Ext.data.Model',
fields: ["userId", "userName"]
});
var userRecord = Ext.create("UserModel", {
userId: "1",
userName: "youring"
});
var formCmp = this.up("form");
formCmp.loadRecord(userRecord);
loadData()
code:
Ext.define("Ext.overrides.form.Panel", {
override: "Ext.form.Panel",
loadData : function(data){
if(data){
for(var key in data){
var field = this.down('[name='+ key + ']');
if(field){
field.setValue(data[key]);
}
}
}
}
});