Ext.define("Imobfusion.data.User",{
extend: "Ext.data.Model",
fields:[
{name: "name",type: "string"},
{name: "email",type: "email"},
{name: "password",type: "password"}
],
proxy: {
type: 'ajax',
api: {
read: '/user/read',
create: '/user/create',
update: '/user/update',
destroy: '/user/destroy'
},
reader: {
type: 'json'
},
writer: {
type: 'json'
}
}
});
Have a simplist way to bind model with form like this?:
Ext.define('Imobfusion.window.UserForm', {
extend: 'Ext.form.Panel',
model: 'Imobfusion.data.User' //This is my need (XD)
});
You can use
loadRecord()method witch loads anExt.data.Modelinto this form by callingsetValueswith the record data and on save useupdateRecord()witch persists the values in this form into the passed Ext.data.Model object in a beginEdit/endEdit block. If the record is not specified, it will attempt to update (if it exists) the record provided to loadRecord. or just usegetRecord()andgetValues()to update the record.