ext FormPanel的创建

function addZxOffice(){
	initZxOfficeFormAdd();
	zxOfficeWinAdd = Ext.create('Ext.Window',{
		layout:'fit',
		width:700,
		height:500,
		maximizable:true,
		minimizable:true,
		animateTarget:document.body,
		plain:true,
		modal:true,
		title:'添加信息',
		listeners:{
			minimize:function(win,opts){
				if(!win.collapse()){
					win.collapse();
				}else{
					win.expand();
				}
			}
		},
		items:zxOfficeFormAdd,
		buttons:[{
			text:'保存',
			itemId:'save',
			handler:function(button){
				submitForm(zxOfficeFormAdd,'../zxOfficeController/addZxOffice',grid,zxOfficeWinAdd,false,true);
			}
		},{
			text:'关闭',
			itemId:'close',
			handler:function(button){
				button.up('window').close();
			}
		}]
	});
	zxOfficeWinAdd.show();
	
}
function initZxOfficeFormAdd(){
	zxOfficeFormAdd = Ext.create('Ext.FormPanel',{
		xtype:'form',
		waitMsgTarget:true,
		defaultType:'textfield',
		autoScroll:true,
		/**新方法使用开始**/
		scrollable:true,
		scrollable:'x',
		scrollable:'y',
		/**新方法使用结束**/
		fieldDefaults:{
			labelWidth:70,
			labelAlign:'left',
			flex:1,
			margin:'2 5 4 5'
		},
		items:[
         {
	       fieldLabel:'办公用品分类',
	       xtype:'treepicker',
			displayField:'text',
			anchor:'60%',
			hiddenName:'classify_id',
			name:'classify_id',
			minPickerHeight:200,
			maxHeight:200,
			editable:false,
			allowBlank:false,
			store:Ext.create('Ext.data.TreeStore',{
				fields:['id','text'],
				root:{
					text:'一级分类',
					id:'0',
					expanded:false
				},
				proxy:{
					type:'ajax',
					url:'../zxOfficeClassifyController/getZxOfficeClassifyTree',
					reader:{
						type:'json'
					}
				}
			})
        },
		
		{
			fieldLabel:'办公用品',
			xtype:'textfield',
			name:'name',
			maxLength:100,
			anchor:'60%'
		},
		{
			fieldLabel:'办公用品编号',
			xtype:'textfield',
			name:'num',
			maxLength:100,
			anchor:'60%'
		},
		{
			fieldLabel:'分类ID',
			hidden:true,
			xtype:'textfield',
			name:'classify_id',
			maxLength:32,
			anchor:'60%'
		},
		{
			fieldLabel:'度量衡,单位',
			xtype:'textfield',
			name:'unit',
			maxLength:10,
			anchor:'60%'
		},
		{
			fieldLabel:'状态',
			xtype:'combo',
			emptyText:'请选择',
			store:zx_office_delete,
			mode:'local',
			triggerAction:'all',
			editable:false,
			allowBlank:false,
			hiddenName:'status',
			valueField:'value',
			displayField:'text',
			name:'status',
			maxLength:2,
			anchor:'60%'
		},
		/*{
			fieldLabel:'创建时间',
			xtype:'datetimefield',
			format:'Y-m-d H:i:s',
			name:'create_date',
			maxLength:19,
			anchor:'100%'
		},*/
		{
			fieldLabel:'规格型号',
			xtype:'textfield',
			name:'standard',
			maxLength:255,
			anchor:'60%'
		}
		]
	});

你可能感兴趣的:(ext FormPanel的创建)