如题
下面是页面的<!-- 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>下面是JS里面的代码: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();
    }
});所有该试的发病高发都写了就是不管用 帮忙啊

解决方案 »

  1.   

    Ext.getCmp("formId").getForm().reset()我就是这样弄的,就可以
      

  2.   

    实在不行的话,就Ext.getCmp("id属性").setValue('')我以前也碰到过这样的问题,就是这样弄的
      

  3.   

    id属性 是针对form的还是里面标签的 我是第一次用这个 
      

  4.   

    Microsoft JScript 运行时错误: 对象不支持此属性或方法
    Microsoft JScript 运行时错误: 'Ext.getCmp(...)' 为空或不是对象
    一直这2个错误
      

  5.   

    我知道你写的重置代码哪出问题了,不是Ext.getCmp('aaa').form.reset();
    而是Ext.getCmp('form-widgets').form.reset();,getCmp("这里面是元素的id,比如form的id,或者form里面的某一个标签的id")
      

  6.   

    我改成'form-widgets'了 也不行都使用过了
    我给'TextField'设置了个ID就能重置了 问题是我要20多个'TextField' 不可能要20个ID吧 很麻烦啊
      

  7.   

    你可以给他们的id取差不多一样的,比如id:'id_'+1,id:'id_'+2这样的,然后在重置方法里写个循环,用Ext.getCmp("id_"+i)【i为for里面的i】,然后再重置,也只有这个办法了,我也想不到更好的了,嘻嘻
      

  8.   


    不用谢,创建form不应该是new Ext.FormPanel啊?Ext.form.FieldSet好像是创建表单字段的,不能清空是不是因为创建FormPanel出错了。只是猜测
      

  9.   

    大神啊
    我也有这样的问题,
    //_movieForm.getForm().reset();
    //_movieForm.form.reset();
    _movieForm.getForm().getEl().dom.reset();三种方法就只有最后一种有效果,但是我Form里面有个隐藏的ID,
    重置的时候ID还在,有什么解决的办法吗?
      

  10.   

    我的Form是放在window里面的一个组件,我的作法是双击Grid某行,将这行信息弄到form里面,然后有三个按钮,
    修改 清空 删除   当点清空时把表单清空,将第一个按钮设置成  添加  ....
    然后根据id来判断是做修改还是添加..
    可以id没有清空,一直在怎么解决啊?