日期:2014-05-19 浏览次数:21020 次
<!-- LIBS -->
<script type="text/javascript" src="../ext-3.3.1/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="../ext-3.3.1/ext-all-debug.js"></script>
MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {
id: 'grid-win',
init: function () {
this.launcher = {
text: 'Grid Window',
iconCls: 'icon-grid',
handler: this.createWindow,
scope: this
}
},
createWindow: function () {
var desktop = this.app.getDesktop();
var win = desktop.getWindow('grid-win');
var aaa = new Ext.form.FieldSet({
xtype: 'form',
id: 'form-widgets',
title: 'Form Widgets',
width: 630,
height: 700,
frame: true,
x: 50, y: 260,
bodyStyle: {
padding: '10px 20px'
},
defaults: {
anchor: '98%',
msgTarget: 'side',
allowBlank: false
},
items: [{
xtype: 'label',
text: 'Plain Label'
}, {
fieldLabel: 'TextField',
xtype: 'textfield',
emptyText: 'Enter a value',
itemCls: 'x-form-required'
}, {
fieldLabel: 'ComboBox',
xtype: 'combo',
store: ['Foo', 'Bar'],
itemCls: 'x-form-required',
resizable: true
}, {
fieldLabel: 'DateField',
itemCls: 'x-form-required',
xtype: 'datefield'
}, {
fieldLabel: 'TimeField',
itemCls: 'x-form-required',
xtype: 'timefield'
}, {
fieldLabel: 'NumberField',
emptyText: '(This field is optional)',
allowBlank: true,
xtype: 'numberfield'
}],
buttons: [{
text: '重置',
cls: 'x-icon-btn',
iconCls: 'x-icon-btn-reset',
handler: function () {
alert(aaa.id);
// aaa.form.reset(); //重置form
// aaa.getForm().getEl().dom.reset(); //重置form
Ext.getCmp('aaa').form.reset();
}
}]
});
if (!win) {
win = desktop.createWindow({
width: 715, height: 300, plain: true, resizable: false, modal: true, layout: 'fit', xtype: 'form',
id: 'grid-win',
title: 'Grid Window',
iconCls: 'icon-grid',
items: [aaa]
});
}
win.show();
}
});