re: Ext 2.0使用:组件开发模式 虎啸龙吟 2007-11-15 19:40
我这里也有一段代码,是从Ext 论坛上摘下来的,实现用form当window来使用,我就是不能调用继承下来的类,请帮我实现一下:谢了.
ComplainFormWindow= function(){
this.complainForm= new Ext.form.FormPanel({
labelWidth: 75, // label settings here cascade unless overridden
url:'ComplainControlLayer.aspx',
frame:true,
bodyStyle:'padding:5px 5px 0',
width: 500,
items: [{
layout:'column',
items:[{
columnWidth:.5,
layout: 'form',
xtype:'fieldset',
title: 'Personal Information',
autoHeight:true,
items: [{
xtype:'textfield',
fieldLabel: '<b>First Name</b>',
name: 'fName',
allowBlank:false,
anchor:'95%'
},{
xtype:'textfield',
fieldLabel: '<b>Middle Name</b>',
name: 'mName',
anchor:'95%'
}
,
{
xtype:'textfield',
fieldLabel: '<b>Last Name</b>',
allowBlank:false,
name: 'lName',
anchor:'95%'
},
{
xtype:'textfield',
fieldLabel: '<b>E-mail Add</b>',
name: 'e-mail',
allowBlank:true,
vtype:'email',
anchor:'95%'
}]
},{
columnWidth:.5,
layout: 'form',
xtype:'fieldset',
title: '<b>Personal Information</b>',
labelWidth:60,
autoHeight:true,
items: [{
xtype:'textfield',
fieldLabel: '<b>Address</b>',
allowBlank:false,
name: 'address',
anchor:'95%'
},
{
xtype:'textfield',
fieldLabel: '<b>Ward No</b>',
allowBlank:false,
name: 'ward',
anchor:'95%'
}]
}]
},{
layout:'column',
xtype:'fieldset',
title:'<b>Other Information</b>',
autoHeight:true,
items:[{
columnWidth:.5,
layout: 'form',
autoHeight:true,
items: [this.deptCombo]
},{
columnWidth:.5,
layout: 'form',
labelWidth:50,
autoHeight:true,
items: [{
xtype:'textfield',
fieldLabel: '<b>Subject</b>',
name: 'subject',
allowBlank:false,
anchor:'95%'
}]
}]
}
,{
layout: 'form',
xtype:'fieldset',
title: '<b>Insert Comment</b>',
autoHeight:true,
items:[{
xtype:'textarea',
name:'comment',
allowBlank:false,
hideLabel:true,
height:120,
anchor:'98%'
}]
}],
buttons: [{
text: 'Save',
handler:this.formSubmit,
scope:this
},{
text: 'Cancel',
handler: function(){
this.hide();
},
scope:this
}]
});
ComplainFormWindow.superclass.constructor.call(this, {
title: 'Layout Window',
closable:true,
width:800,
height:475,
closeAction:'hide',
layout: 'fit',
items:this.complainForm
});
}
Ext.extend(ComplainFormWindow,Ext.Window,{
formSubmit: function(){
if(this.complainForm.form.isValid())
{
this.complainForm.form.submit({params:{
requestData: 'addnewcomplain'},
failure: function() {
// Ext.MessageBox.alert('Error Message',"fail");
alert('h');
},
success: function() {
//win.close();
}
});
}
else{
Ext.Msg.alert('Complain Submit', 'Enter the Field');
}
}
});