在三级窗口定义的window,想将其显示在顶层,使用top.Ext.Window定义,怎样将formPanel放入其中?在其中使用Ext.getCmp()报错,怎么解决??

解决方案 »

  1.   

    报神马错?找不到对象?如果是, 就一层一层alert对象,看看有没有在对象在没被加载前就被使用的情况。
      

  2.   

    var updateTestWin = new top.Ext.Window({
    id : 'updateTestWin',
    width : 290,
    height : 150,
    title : '测试',
    plain : true,
    closable : true,
    resizable : false,
    layout: 'fit',
    frame : true,
    modal : true,
    items : [{
    autoScroll : true,
    xtype : 'form',
    labelAlign : 'left',
    buttonAlign : 'center',
    bodyStyle : 'padding:5px',
    frame : true,
    name : 'testForm',
    id : 'testForm',
    labelWidth : 80,
    model : true,
    defaultType : 'textfield',
    defaults : {
    anchor : '95%'
    },
    items : [ {
    name : 'Name',
    fieldLabel : '用户名',
            value : "" // 默认值
    }, {
    id : 'password',
    fieldLabel : '密   码',
    value : ""
    }],
    buttons : [ {
    text : '提交',
    iconCls : 'icon-ok',
    handler : function(){
    alert(Ext.getCmp('updateTestWin'));
    var form = Ext.getCmp('updateTestWin').getForm();
    values = form.getFieldValues();
    Ext.Msg.confirm("提示","确认提交?",callback);
    }
    }, {
    text : '取消',
    iconCls : 'icon-close',
    handler : function() {
    updateTestWin.close();
    }
    } ]
    }]
    });

    updateTestWin.show();
    代码如上,提示Ext.getCmp('updateTestWin')为空啊
      

  3.   

    我在top.Ext.Window里面定义了个form,获取form的值时出错
      

  4.   

    Quote: 引用 2 楼 fengdy0520 的回复:

    Quote: 引用 1 楼 ckk521 的回复:

    var form = Ext.getCmp('testForm').getForm();获取form值,id用错,该过来也是这个问题,刚接触Ext不久,不知道怎么办啊