maozhibin2008 2008-09-27 11:14
浏览 281
已采纳

ext.Window 第一次打开对话框没问题,第二次,次三.....就不行了

一、表述:
    使用Ext.grid.GridPanel创建gird对象。grid的最后一列定义为{header: '授权',dataIndex: 'operate1',sortable: true,renderer:authorization},即点击最后一列中的元素将对话框。
二、错误描述:
    第一次弹出的对话框没有问题,第一此没有问题,第二,第三。。。。次就有问题了,每多点击一次对话框就会多嵌套一层对话框,对话框不断的嵌套,不知道是怎么回事,  多谢各位高手能指点一二、谢谢了!

manageMySellerGrid = function(title, id){
    //新窗体
    showMemerAddWindow = function(){
        memberAddWindow = new Ext.Window({
            el: 'window_win',
            layout: 'fit',
            width: 300,
            height: 200,
            closable: true,
            closeAction: 'hide',
            plain: true,
            items: [memberForm]
        });
        //memberAddWindow.show(Ext.get('newWindowButton'));
        memberAddWindow.show();
    }
    
    authorization =  function(value, cellmeta, record){
        if(record.data['userTYpe']==1){
            return '授权';
        }else{
            return '';
        }
    }
   authorizationOperate1=function(){
        var win  = authorizationOperate();
        win.show();
    }
    authorizationOperate = function(){
        var win = new Ext.Window({
            applyTo:'hello-win',
            layout:'fit',
            width:500,
            height:350,
            closeAction:'hide',
            closable:true,
            plain:false,
            modal:true,
            title:'测试'
//          items:new Ext.TabPanel({
//               activeTab:0,
//               border:false,
//               items:[{title:"tab1",html:"tab1在windows窗口中"},{title:"tab2",html:"tab2在windows窗口中"}]
//          })          
        });
        return win;
    }
    /**
     * 以下是表单
     */
    //账号
    var idField = new Ext.form.TextField({
        fieldLabel: '账号',
        name: 'memberName',
        allowBlank: false,
        anchor: '90%',
        blankText: '账号不能为空'
    });
    //密码
    var passwordField = new Ext.form.TextField({
        inputType: 'password',
        fieldLabel: '密码',
        name: 'password',
        allowBlank: false,
        anchor: '90%',
        blankText: '密码不能为空'
    });
    //密码确认
    var repasswordField = new Ext.form.TextField({
        inputType: 'password',
        fieldLabel: '密码确认',
        name: 'repassword',
        allowBlank: false,
        anchor: '90%',
        blankText: '确认密码不能为空'
    });
    //电子邮件
    var emailField = new Ext.form.TextField({
        fieldLabel: '电子邮件',
        name: 'email',
        allowBlank: false,
        anchor: '90%',
        vtype: 'email',
        blankText: '电子邮件不能为空'
    });
    //真实姓名
    var trueNameField = new Ext.form.TextField({
        fieldLabel: '真实姓名',
        name: 'trueName',
        allowBlank: false,
        anchor: '90%',
        blankText: '真实姓名不能为空'
    });
    var memberForm = new Ext.FormPanel({
        monitorValid: true,
        labelAlign: 'top',
        frame: true,
        title: '添加新商户信息',
        width: 300,
        url: './userManage.jsp?command=insert&groupid=' + sGroupid,
        
        items: [{
            layout: 'column',// 该FormPanel的layout布局模式为列模式(column),包含2列  
            items: [{//第一列  
                columnWidth: 0.5,
                layout: 'form',
                items: [idField, passwordField]
            }, {//第二列  
                columnWidth: 0.5,
                layout: 'form',
                items: [repasswordField, emailField]
            }, {
                columnWidth: 0.5,
                layout: 'form',
                items: [trueNameField]
            }]
        }],
        buttons: [{
            text: '提交',
            formBind: true,
            handler: function(){
                if (memberForm.getForm().isValid()) {
                    memberForm.getForm().submit({
                        method: 'POST',
                        waitMsg: '保存中,请稍后...',
                        success: function(){
                            memberForm.getForm().reset();
                            memberAddWindow.hide();
                            ds.reload();
                        },
                        failure: function(){
                            Ext.Msg.alert('错误', '服务器出现错误请稍后再试!');
                        }
                    });
                }
            }
        }, {
            text: '取消',
            handler: function(){
                memberForm.getForm().reset();
                memberAddWindow.hide();
            }
        }]
    });
    //添加标注
    
    addTabOfMerLabel = function(url, title,id){
        var mytab = myTabPanel.getItem(id);
        if(null==mytab){
            myTabPanel.add(myGrid(url, title,id)).show();
        }else{
            myTabPanel.setActiveTab(mytab);
        }
    }
    //查看每个商户的标注 
    examineLabel = function(value, cellmeta, record, rowIndex, columnIndex, store){
        var userId = record.data['id'];
        var url = '/mapscene/member/merGrid.jsp?userId=' + userId;
        var title = userId + '的标注';
        var str = "查看标注";
        //var str = "查看标注";
        return str;
    }
    reader = new Ext.data.JsonReader({
            totalProperty: 'totalProperty',
            root: 'root'
        }, [
            {name: 'id'}, 
            {name: 'email'}, 
            {name: 'trueName'}, 
            {name: 'sex'}, 
            {name: 'password'}, 
            {name: 'telephone'}, 
            {name: 'fax'}, 
            {name: 'company'}, 
            {name: 'mobile'}, 
            {name: 'address'}, 
            {name: 'qq'}, 
            {name: 'msn'}, 
            {name: 'description'},
            {name: 'userTYpe'},  
            {name: 'createDatetime'}, 
            {name: 'operate'},
           {name: 'operate1'}
        ]
    );
    var ds = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
            url: '/mapscene/member/seller.jsp'
        }),
        reader: reader,
        baseParams:{userType:null,idOfSearch:null,command:'query'}
    });
    //列模型
    var sm  = new Ext.grid.CheckboxSelectionModel();
    var cm = null;
    if(i_userType==3){
        cm=new Ext.grid.ColumnModel([
            new Ext.grid.RowNumberer(), 
            sm,
            {header: '账号',dataIndex: 'id',sortable: true}, 
            {header: '电子邮件',dataIndex: 'email',sortable: true}, 
            {header: '真实姓名',dataIndex: 'trueName',sortable: true}, 
            {header: '性别',dataIndex: 'sex',sortable: true}, 
            {header: '密码',dataIndex: 'password'}, 
            {header: '电话号码',dataIndex: 'telephone',sortable: true}, 
            {header: '传真',dataIndex: 'fax',sortable: true}, 
            {header: '公司名称',dataIndex: 'company',sortable: true}, 
            {header: '手机号码',dataIndex: 'mobile',sortable: true}, 
            {header: '详细地址',dataIndex: 'address',sortable: true}, 
            {header: 'qq号码',dataIndex: 'qq',sortable: true}, 
            {header: 'msn',dataIndex: 'msn',sortable: true}, 
            {header: '描述',dataIndex: 'description'}, 
            {header: '创建时间',dataIndex: 'createDatetime',sortable: true}, 
            {header: '操作',dataIndex: 'operate',renderer: examineLabel},
           {header: '授权',dataIndex: 'operate1',sortable: true,renderer:authorization}
        ]);
    }else{
        cm=new Ext.grid.ColumnModel([
            new Ext.grid.RowNumberer(), 
            sm,
            {header: '账号',dataIndex: 'id',sortable: true}, 
            {header: '电子邮件',dataIndex: 'email',sortable: true}, 
            {header: '真实姓名',dataIndex: 'trueName',sortable: true}, 
            {header: '性别',dataIndex: 'sex',sortable: true}, 
            {header: '密码',dataIndex: 'password'}, 
            {header: '电话号码',dataIndex: 'telephone',sortable: true}, 
            {header: '传真',dataIndex: 'fax',sortable: true}, 
            {header: '公司名称',dataIndex: 'company',sortable: true}, 
            {header: '手机号码',dataIndex: 'mobile',sortable: true}, 
            {header: '详细地址',dataIndex: 'address',sortable: true}, 
            {header: 'qq号码',dataIndex: 'qq',sortable: true}, 
            {header: 'msn',dataIndex: 'msn',sortable: true}, 
            {header: '描述',dataIndex: 'description'}, 
            {header: '创建时间',dataIndex: 'createDatetime',sortable: true}, 
            {header: '操作',dataIndex: 'operate',renderer: examineLabel}
        ]);
    }
    var grid = new Ext.grid.GridPanel({
        id: id,
        closable: true,
        ds: ds,
        cm: cm,
        sm:sm,
        viewConfig: {forceFit: true},
        width: 1000,
        height: 2000,
        loadMask: {msg: '正在加载数据,请稍侯……'},
        title: title,
        frame: true,
        renderTo: 'mylabel',
        tbar: [{
            text: '删除',
            tooltip: '删除选中的项目',
            //          iconCls:'remove',
            handler: function(){
                var selectedRows = grid.getSelectionModel().getSelections();
                var ids = [];
                for(var i=0;i<selectedrows.length;i++){ var="" item="selectedRows[i].data;" ids.push(item.id);="" }="" if(ids.join('')="=''){Ext.MessageBox.alert('警告'," '必须选择一条记i录,进行删除!');return;}="" ext.messagebox.confirm('提示框',="" '你确定要进行该操作吗?!',="" function(btn){="" if="" (btn="=" 'yes')="" {="" ext.lib.ajax.request(="" 'post',="" 'usermanage.jsp',="" {="" success:="" function(e,="" b){="" var="" message="e.responseText;" ext.msg.alert('信息',="" message);="" ds.load({="" params:="" {="" start:="" 0,="" limit:="" 10="" }="" });="" },="" failure:="" function(){="" ext.msg.alert('错误',="" '删除时出现未知的错误');="" }="" },="" 'command="delete&amp;ids='" +="" ids="" );="" }="" });="" }="" },="" '-',="" {="" id:="" 'newwindowbutton',="" text:="" '新面板中添加',="" iconcls:'user_add',="" handler:="" function(){="" showmemeraddwindow();="" 显示表单所在窗体="" }="" },'-',new="" ext.form.combobox({="" listclass:'x-combo-list-small',="" width:120,="" value:'请选择一种用户类型',="" id:'search-type',="" store:susername="='admin'?" new="" ext.data.simplestore({="" fields:="" ['text'],="" expanddata:="" true,="" data="" :="" ['请选择一种用户类型','普通用户',="" '代理商用户',="" '商户用户']="" }):new="" ext.data.simplestore({="" fields:="" ['text'],="" expanddata:="" true,="" data="" :="" ['请选择一种用户类型',="" '商户用户']="" }),="" displayfield:="" 'text',="" mode:="" 'local',="" forceselection:="" true,="" triggeraction:="" 'all',="" selectonfocus:true="" }),'-',new="" ext.form.textfield({="" fieldlabel:="" '',="" name:="" 'idofsearch',="" anchor:="" '90%'="" }),{="" text:="" '查询',="" tooltip:="" '删除选中的项目',="" handler:="" function(){="" var="" searchtype="Ext.get(&quot;search-type&quot;).getValue();" if(searchtype="='请选择一种用户类型'){" searchtype="null;" }else="" if(searchtype="='普通用户'){" searchtype="0;" }else="" if(searchtype="='代理商用户'){" searchtype="1;" }else="" if(searchtype="='商户用户'){" searchtype="2;" }="" var="" idofsearch="Ext.get(&quot;idOfSearch&quot;).getValue();" ds.baseparams.usertype="searchType;" ds.baseparams.idofsearch="idOfSearch;" if="" (searchtype="" !="null)" {="" ds.baseparams.command="search" ;="" }else{="" ds.baseparams.command="query" ;="" }="" ds.load({="" params:="" {="" start:="" 0,="" limit:="" 10="" }="" });="" }="" },'-'="" ],="" bbar:="" new="" ext.pagingtoolbar({="" pagesize:="" 10,="" store:="" ds,="" displayinfo:="" true,="" displaymsg:="" '显示第="" {0}="" 条到="" {1}="" 条记录,一共="" {2}="" 条',="" emptymsg:="" "没有记录"="" })="" });="" grid.render();="" ds.load({="" params:="" {="" start:="" 0,="" limit:="" 10="" }="" });="" return="" grid;="" }<="" pre="">

 

  • 写回答

1条回答 默认 最新

  • aday 2008-09-29 23:35
    关注

    因为你每次都在同一个ID上渲染,所以就叠加了
    [code="java"]
    applyTo:'hello-win',
    [/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器