extjs问题
chenxiaoji
2008-07-06
帮我看看,form为什么不能加载数据
Ext.onReady(function(){ Ext.QuickTips.init(); // turn on validation errors beside the field globally Ext.form.Field.prototype.msgTarget = 'side'; var fs = new Ext.FormPanel({ frame: true, title:'jsomn Form', labelAlign: 'right', labelWidth: 85, width:340, waitMsgTarget: true, // configure how to read the json Data reader : new Ext.data.JsonReader({ //success: 'success', record : 'data', }, [ {name: 'name', mapping:'name'}, // custom mapping {name: 'sex', mapping:'sex'} ]), items: [ new Ext.form.FieldSet({ title: 'Contact Information', autoHeight: true, defaultType: 'textfield', items: [{ fieldLabel: 'sex', name: 'name', width:190 },{ fieldLabel: 'sex', name: 'sex', width:190 } ] }) ] }); fs.render('form-ct'); fs.form.load({url: 'WebForm2.aspx?id=1',method:'GET', waitMsg:'Loading' }); }); JSON数据:{data:[{"id":"1","name":"cxj","sex":"830414"}]} |
|
rikugun
2008-07-07
这样如何:
var fp_store new Ext.JsonStore({ id:id, url:'WebForm2.aspx?id=1', method:'get', root:'data', fileds:['id','name','sex'] }); 然后 fp_store.load(); fp_store.on('load',function(s,r,op){ fs.form.loadRecord(r[0]); }); |