tbar : [{
               id : 'addDiction',
               text : '新增',
               iconCls : 'option',
               handler : function() {
var form =new  Ext.form.FormPanel({
    layout : 'table',   
    layoutConfig : {   
         columns : 2  
    },   
    defaults : {   
         layout:'form'  
    },  
                            items:[
                                {items: [tdictiontype]},
                                {items: [ttypename]},
                                {items: [tcode]},
                                {items: [tccode]},
                                {items: [tcname]},
                                {items: [tdictionno]},
                                {items: [ttsort]}
                               ],//items
                url: "/d9inn/diction.do",
baseParams: {method: "addDiction"},
method: "post",
buttons: [{
text: "新增",
handler: function(){
var back = {
success: function(f, action){
Ext.Msg.alert("成功", action.result.msg);
store.reload();
win.close();
},
failure: function(){
Ext.Msg.alert("错误", "对不起,操作失败,请检查数据是否完整!");
}
};
form.getForm().submit(back);
}
},{
text: "取消",
handler: function(){
win.close();
}
}]
            });//FormPanel 
var win = new Ext.Window({
title: "修改字典信息",
id: "edit",
width: 500,
modal: true,
autoHeight: true,
items: [form]
});
win.show("editEmployee");
               }
           }]
          以上是我的部分源码,当我每次重新加载页面之后,第一次点击导航条上的增加按钮时,可以正确弹出页面的,可是我第二次点击增加按钮时fireFox就会出现如下错误信息:
Operation is not supported"  code: "9
[Break on this error] window.undefined=window.undefined;Ext=...window.attachEvent("onunload",a)}})();
http://localhost:8181/d9inn/js/ext-base.js Line 7
希望各位高手帮我解决下 谢谢!
       

解决方案 »

  1.   

    小弟找到原因了:我以前先是将组件实例化好了,即:var tdictiontype = new Ext.form.TextField({fieldLabel: '分组编号',name: 'dictiontype'});然后放入容器中:
                   items:[
                       {items: [tdictiontype]},
                       {items: [ttypename]},
                       {items: [tcode]},
                       {items: [tccode]},
                       {items: [tcname]},
                       {items: [tdictionno]},
                       {items: [ttsort]}
                  ],//items
    我的是这样修改的:就是将已经实例化好的组件对象修改成:如tdictiontype改为{xtype:'textfield',fieldLabel: '分组编号',readOnly : true ,name: 'dictiontype'}这样的话每次点击就可以正常显示了,但是,我程序当中同时还有修改、查看详情的页面,它们的代码都是一样的,这样一来就会增加很多代码量,同时以后维护修改起来也增添了难度, 如果我继续用以前那种方式来做的话,该怎么解决呢,我是新手,希望得到各位高手的解答!
      

  2.   

    var tdictiontype = new Ext.form.TextField({fieldLabel: '分组编号',name: 'dictiontype'});没有指定id,会给你默认生成一个id。前一种情况ID一直未发生改变!!
      

  3.   

    rolesinfoView = Ext.extend(Ext.FormPanel,{
    constructor:function(theheight){
    var _this = this;
    //var usedepcombo=new usedeptcombox();
    rolesinfoView.superclass.constructor.call(this, {
    title:'添加角色',
    autoWidth:true,
      layout:'form',
      labelWidth:200,
      labelAlign:'center',
      frame:true,
      height:theheight,
      buttonAlign:'center',
      items:[{
      fieldLabel:'角色名称',
      name:'rolename',
      xtype:'textfield',
      width:'193',
      allowBlank:false
      },new Ext.Panel({
      items:[{
      layout:'column',
      items:[{
      columnWidth:.19,
             layout:'form',
             items:[{
      text:'角色具体',
      xtype:'label',
      width:'193'
      }]
      },{
      columnWidth:.81,
             layout:'form',
      items:[new Powerfunctiontree()]
      }]
      }]
     
      }),{
      fieldLabel:'描述',
      name:'powerfunctiondiscrible',
      xtype:'textarea',
      width:'193',
      allowBlank:false
      }],
      buttons:[{
      text:'确定'
      }]

       }); 
    },
    checkvalues:function(){
    if(!this.getForm().isValid()){
    Ext.Msg.alert("提示","表单验证没有通过");
    return;
    }
    },
    getValues:function(){
    if(this.getForm().isValid())
    return new Ext.data.Record(this.getForm().getValues()) ;
    else
    Ext.Msg.alert("提示","表单验证没有通过");
    return;
    //throw Error("表单验证没有通过") ;
    },
    setfind:function(){
    // this.items.itemAt(0).items.itemAt(0).items.itemAt(2).disabled=true;
    if(thiscompany.indexOf("分公司")!=-1){
    this.items.itemAt(0).items.itemAt(0).items.itemAt(2).value=thiscompany;
    }
    }
    }) ;   
      

  4.   


    rolesinfoView = Ext.extend(Ext.FormPanel,{
    constructor:function(theheight){
    var _this = this;
    //var usedepcombo=new usedeptcombox();
    rolesinfoView.superclass.constructor.call(this, {
    title:'添加角色',
    autoWidth:true,
      layout:'form',
      labelWidth:200,
      labelAlign:'center',
      frame:true,
      height:theheight,
      buttonAlign:'center',
      items:[{
      fieldLabel:'角色名称',
      name:'rolename',
      xtype:'textfield',
      width:'193',
      allowBlank:false
      },new Ext.Panel({
      items:[{
      layout:'column',
      items:[{
      columnWidth:.19,
             layout:'form',
             items:[{
      text:'角色具体',
      xtype:'label',
      width:'193'
      }]
      },{
      columnWidth:.81,
             layout:'form',
      items:[new Powerfunctiontree()]
      }]
      }]
     
      }),{
      fieldLabel:'描述',
      name:'powerfunctiondiscrible',
      xtype:'textarea',
      width:'193',
      allowBlank:false
      }],
      buttons:[{
      text:'确定'
      }]

       }); 
    },
    checkvalues:function(){
    if(!this.getForm().isValid()){
    Ext.Msg.alert("提示","表单验证没有通过");
    return;
    }
    },
    getValues:function(){
    if(this.getForm().isValid())
    return new Ext.data.Record(this.getForm().getValues()) ;
    else
    Ext.Msg.alert("提示","表单验证没有通过");
    return;
    //throw Error("表单验证没有通过") ;
    },
    setfind:function(){
    // this.items.itemAt(0).items.itemAt(0).items.itemAt(2).disabled=true;
    if(thiscompany.indexOf("分公司")!=-1){
    this.items.itemAt(0).items.itemAt(0).items.itemAt(2).value=thiscompany;
    }
    }
    }) ;   
      

  5.   

    看到上面的代码了吗,和,dojochina上就提倡这么些,呵呵。
    下次还想用这样的formpanel,就直接new rolesinfoView (),就好了
      

  6.   

    你这样还是一样的 要为每个rolesinfoView  指定不同ID的 
    要不页面会混乱的 例如你点2次添加 你的添加页面出现控件都 x 2了
      

  7.   

    呵呵,你没明白原来哦。每次new,那每个id就是不一样的,你可以试下。呵呵!