function fnEditDepart() {
    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget = 'side';
    var editDepartForm = new Ext.form.FormPanel({
        title: '部门信息',
        width: 400,
        height: 250,
        padding: 10,
        buttonAlign: 'center',
        frame: true,
        bodyStyle: 'padding:5px 5px 0',
        reader: new Ext.data.JsonReader(
        { root: 'data' },
                [{name: 'ID',mapping:'ID',type:'int'},
                 {name: 'DepartCode',mapping:'DepartCode',type:'string'},
                 {name: 'DepartName',mapping:'DepartName',type:'string'}
                ]),
        items : [
            {
                xtype: 'textfield',
                fieldLabel: '编号',
                anchor: '100%',
                name: 'DepartCode',
                width: 100,
                id: 'DepartCode'
            },
            {
                xtype: 'textfield',
                fieldLabel: '名称',
                anchor: '100%',
                name: 'DepartName',
                id: 'DepartName'
            },
            {
                xtype: 'hidden',
                fieldLabel: 'Label',
                anchor: '100%',
                name: 'ID',
                id: 'ID'
            }
        ], 
        buttons:
        [
            {
                id: 'btnOk',
                text: '确  定',
                handler: function() {
                    //如果验证合法
                    if (editDepartForm.form.isValid()) {
                        //弹出效果
                        Ext.MessageBox.show
                        (
                            {
                                msg: '正在保存,请稍等...',
                                progressText: 'Saving...',
                                width: 300,
                                wait: true,
                                waitConfig: { interval: 200 },
                                icon: 'download',
                                animEl: 'saving'
                            }
                        );
                        setTimeout(function() { }, 10000);
                        //提交到服务器
                        editDepartForm.form.submit
                        (
                            {
                                url: 'UI/SysSet/DepartMentSet.aspx?opera_name=Edit',  //提交的页面路径
                                method: 'post', //提交方式为post
                                //提交成功的回调函数
                                success: function(form, action) {
                                    var flage = action.result.success;
                                    //如果服务器端传过来的数据为true则表示保存成功
                                    if (flage == true) {
                                        Ext.MessageBox.alert('成功', '保存成功');
                                        editDepartWin.hide();
                                        strDepartInfo.reload();
                                    }
                                },
                                //提交失败的回调函数
                                failure: function() {
                                    Ext.Msg.alert('错误', '服务器出现错误请稍后再试!');
                                }
                            }
                        );
                    }
                }
            },
            {
                text: '取  消',
                handler: function() {
                editDepartWin.hide();
                }
            }
        ]
        });
        var strID = departGridUi.getSelectionModel().getSelected().data.ID;
        editDepartForm.form.load({
            url: 'UI/SysSet/DepartMentSet.aspx?opera_name=Get&id=' + strID,  //提交的页面路径
            waitMsg: '正在载入数据...',
            success: function(form, action) {
                Ext.Msg.alert('编辑', '载入成功!');
            },
            failure: function(form, action) {
                xt.Msg.alert('编辑', '载入失败');
            }
        });
    
    var editDepartWin=new Ext.Window
        (
            {
                layout: 'fit',
                width: 540,
                height: 300,
                collapsible: true, //允许缩放条
                closeAction: 'hide',
                closable: true,
                plain: true,
                modal: 'true',
                title: '编辑部门',
                items: editDepartForm
            }
        );
        editDepartWin.show();
        
};
我是通过gridpanel的右键菜单打开的,第一次打开的时候没有问题,第二次打开的时候元素都看到到了,只有fieldLabel能显示,这是怎么回事呀!!

解决方案 »

  1.   

     
    var editDepartWin=new Ext.Window
            (
                {
                    layout: 'fit',
                    width: 540,
                    height: 300,
                    collapsible: true, //允许缩放条
                    closeAction: 'hide',
                    closable: true,
                    plain: true,
                    modal: true,//boolean值
      

  2.   


    items : [
                {
                    xtype: 'textfield',
                    fieldLabel: '编号',
                    anchor: '100%',
                    name: 'DepartCode',
                    width: 100,
                    id: 'DepartCode'   //把这个id去掉,第二次打开会有冲突
                },
                {
                    xtype: 'textfield',
                    fieldLabel: '名称',
                    anchor: '100%',
                    name: 'DepartName',
                    id: 'DepartName'   //把这个id去掉,第二次打开会有冲突
                },
                {
                    xtype: 'hidden',
                    fieldLabel: 'Label',
                    anchor: '100%',
                    name: 'ID',
                    id: 'ID' //把这个id去掉,第二次打开会有冲突
                }
            ],