z08050211 2013-10-31 15:19 采纳率: 0%
浏览 184
已采纳

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

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

以下为代码:

[code="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();
          }
      }]

});[/code]
  • 写回答

1条回答 默认 最新

  • heroooooo 2013-10-31 21:03
    关注

    userRoleForm 定义了id:'userRoleForm',第二次打开的时候会发现id已经被使用过了,所以不会出现,去掉id的定义即可。不谢。

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

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料