日期:2014-05-17 浏览次数:20653 次
<script type="text/javascript"> Ext.require([ 'Ext.form.*', 'Ext.data.*' ]); Ext.onReady(function(){ var app = new bb.SouthCenter(); }); Ext.define('bb.SouthCenter',{ extend: 'Ext.form.Panel', initComponent: function(){ // Ext.define('bb.formItem',{//在 gridform中使用 extend: 'Ext.data.Model', fields : [ {name:'SiteID',mapping:'SiteID'} ,{name:'SiteName',mapping:'SiteName'} ] }); Ext.apply(this,{ renderTo: 'form-ct', frame: true, title:'XML Form', width: 340, bodyPadding: 5, waitMsgTarget: true, fieldDefaults: { labelAlign: 'right', labelWidth: 85, msgTarget: 'side' }, reader : this.creatReader(), items: [{ xtype:'textfield', fieldLabel: 'SiteID', name: 'SiteID' }, { xtype:'textfield', fieldLabel: 'SiteName', name: 'SiteName' }], buttons: [{ text: 'Load', listeners:{ scope: this,//范围 click:this.loadurl } }] }); this.callParent(arguments); }, loadurl:function(){ this.getForm().load({ url: '/database/item.txt', waitMsg: 'Loading...' }); }, creatReader:function(){ this.Reader=Ext.create('Ext.data.reader.Array', { model:'bb.formItem', record : 'items', implicitIncludes:true }); return this.Reader; } }); </script>
{items:{ SiteID:'ID1', SiteName:'marshalmackes', } }