formpanelフォームとjsonデータの結合

1012 ワード

もっと読む
シーン:
データベースレコードを変更するときは、まずこのレコードを調べてからフォームフィールドにセットして、バックグラウンドに変更を提出します.

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' }
    ]
}