开发者社区> 问答> 正文

ext的itemselector在窗口中,第二次打开窗口时双击不管用,求解决方法

ext的itemselector在窗口中,就第一次打开窗口时双击管用,第二次及以后打开窗口时双击不管用,求解决方法!

以下为代码:

Js代码 收藏代码

//用户角色关系表单  
    var userRoleForm =  new Ext.form.FormPanel({  
        width:500,  
        bodyStyle: 'padding:10px;',  
        items:[{  
            id:'userRoleForm',  
            xtype:"itemselector",  
            name:"userRoleForm",  
            hideLabel:true,  
            dataFields:["id", "name"],  
            toStore:userRoleDSOfRight,  
            msWidth:200,  
            msHeight:300,  
            valueField:"id",  
            displayField:"name",  
            imagePath:ctx + "/commons/lib/ExtJS/images/",  
            toLegend:"已选角色",  
            fromLegend:"角色",  
            fromStore:userRoleDSOfLeft,  
            fromTBar:[{  
                xtype:'textfield',  
                name:'searchRS',  
                id:'searchUserRole'  
            },{  
                text:'查询',  
                handler:function(){  
                    var a = userRoleDSOfLeft;  
                    userRoleDSOfLeft.filter('name',Ext.get('searchUserRole').dom.value,true,false);  
                }  
            }],  
            toTBar:[{  
                text:"清空",  
                handler:function(){  
                    var i=userRoleForm.getForm().findField("userRoleForm");  
                    i.reset.call(i);  
                }  
            }]  
        }]  
    });  
      
    //弹出窗口  
    var userRoleWin = new Ext.Window({  
          title : '分配用户角色',  
          autoScroll : true,  
          width : 500,  
          height : 420,   
          closeAction : 'hide',  
          layout : 'fit',  
          modal : true,   
          draggable:false,//不可拖拽  
          resizable:false,//设置窗口大小不可改变  
          closable:false,  
          buttonAlign:'center',  
          items : userRoleForm,  
          buttons: [{  
              text: '保存',  
              handler: function(){  
                    if(userRoleForm.getForm().isValid()){  
                        userRoleForm.getForm().submit({  
                        url:"../user/saveUserRole",  
                        method:"POST",  
                        params:{userId:userId},  
                        success: function(form, action){  
                            var i=userRoleForm.getForm().findField("userRoleForm");  
                            i.reset.call(i);  
                            userRoleWin.destroy();  
                            userRoleForm.destroy();  
                            Ext.Msg.alert("提示", action.result.errors);  
                            },  
                        failure:function(form, action) {    
                            Ext.Msg.alert("错误", action.result.errors);    
                        }    
  
                        });  
                    }  
                }},{  
              text:'关闭',  
              handler:function(){  
                  var i=userRoleForm.getForm().findField("userRoleForm");  
                  i.reset.call(i);  
                  userRoleWin.destroy();  
                  Ext.getCmp("userRoleForm").destroy();  
              }  
          }]  
          
    });

展开
收起
长安归故里. 2020-01-07 13:55:43 885 0
1 条回答
写回答
取消 提交回答
  • userRoleForm 定义了id:'userRoleForm',第二次打开的时候会发现id已经被使用过了,所以不会出现,去掉id的定义即可。不谢。

    2020-01-07 13:56:00
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载