当我们修改数据库记录时,需要先查询出该条记录,然后set到form表单字段中,然后提交修改到后台。
this.fsf = new Ext.FormPanel({ reader:new Ext.data.JsonReader({ root: 'data', fields:[ {name: 'id', mapping: 'id'}, {name: 'userName', mapping: 'userName'}, {name: 'Email', mapping: 'email'}, {name: 'phoneNo', mapping: 'phoneNo'}, {name: 'status', mapping: 'status'}, ] }) });
在载数据:
this.fsf.getForm().load({url:'sys/queryUserInfo?id=123', waitMsg:'Loading'});
json数据格式
{ results: 1, rows: [ { id: 1, userName: 'Bill', phoneNo: 'Gardener' } ] }