new Ext.Window中有new Ext.form.FormPanel,不会重复出现,且付初始值

 function msgMg(record){
         var data=new Ext.data.Store({///列表框中的选项数据
     proxy: new Ext.data.MemoryProxy([{"text":"男"},{"text":"女"}]),
     reader: new Ext.data.JsonReader({},['text'])
   });
   data.load();//必须使用,加载数据
         var combo = new Ext.form.ComboBox({
           hiddenName:"ltorSex",id:"lsexBox",
           fieldLabel: "讲师性别",
           store:data,
           width:230,height:22,
           valueField:"text",
           displayField:"text",
     readOnly:true,
           mode: "local",
           triggerAction:"all",
           emptyText:"请选性别...",
           allowBlank:false,
           editable :true
      });
      var val='<input type="hidden" value="" name="ContentBg">'+
    '<textarea id="mctext" name="mail.mctext" style="display:none"></textarea>'+
    '<input type="hidden" name="Up2" id="frushData">'+
    '<div id="ContentWin" style="width:600px;height:350px;float:left;">'+
    ' <iframe id="iframe" src="QzoneEditor/Edit.jsp?I=mail.mctext&B=ContentBg&G=Up2" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No" style="height:100%;width:100%;"></iframe>'+
    '</div>';//里面的iframe是编辑器了
      var form = new Ext.form.FormPanel({
       id:'myform',
           labelAlign: 'top',
          bodyStyle:'padding:5px',
          autoWidth: true,
    url: 'manage/msg.action',//fileUploadServlet
    items: [{
              layout:'column',
              border:false,
              items:[{
                  width :100,labelWidth:35,
                  layout: 'form',border:false,
                  items: [{
                   anchor:'95%',disabled:true,
                      xtype:'textfield',
                      fieldLabel:'编号',
                      id:'Umid'
                  }]
              },{
                  width :120,labelWidth:35,
                  layout: 'form',border:false,
                  items: [{
                   anchor:'95%',id:"UmsgName",
                      xtype:'textfield',
                      fieldLabel: '标题'
                  }]
              },{
              width :120,labelWidth:35,
                    layout: 'form',border:false,
              items: [{
                   anchor:'95%',id:'UupTime',
                   disabled:true,
                   maxValue:(new Date()),
                      xtype:'datefield',
                      fieldLabel:'时间',
                      format:'Y-m-d'
                  }]
         },{
                  width:120,labelWidth:55,
                  layout: 'form',border:false,
                  items: [{
                 anchor:'95%',id:"UmsgKind",
               fieldLabel: '类型',
               xtype:'combo',
               store: typedata,
               displayField:'MsgKind',
               valueField:'Mkid',
               hiddenName:'mkid',
               typeAhead: true,
               mode:'local',
               triggerAction: 'all',
               emptyText:'选择分类...',
               allowBlank: false,
               selectOnFocus:true,
               forceSelection:true
              }]
              },{
                  width:80,labelWidth:0,
                  layout: 'form',border:false,
                  items: [{
                   id: 'imageDo',disabled:true,
                   text: '图片管理',handler:function(){mywin(Ext.getCmp('Umid').getValue(),Ext.getCmp('UmsgName').getValue())},
                   xtype:'button'
                   }]
              },{
                  width:60,labelWidth:0,
                  layout: 'form',border:false,
                  items: [{
                   text: '保存',
                   xtype:'button'
                  }]
              },{
                  width:600,labelWidth:0,
                  layout: 'form',border:false,
                  items: [{id:'editTable',border:false,html:val}]
              }]
          }]
   });
   var msgMgwin = new Ext.Window({//创建弹出窗口
                 //el:'hello-win',---一定去掉
                layout:'fit',
                id:'mywinshow',
                width:635,
                height:457,
                closeAction:'hide',
                plain: true,
                items:form,//窗口中有一个表单
                buttons:[{
                    text:'上传',
                    handler:saveMsg
                },{
                    text: '关闭',
                    handler: function(){
                     msgMgwin.close();
                    }
                }]
            });
        msgMgwin.show();
        if(record!=null){//设置初始值
         Ext.getCmp('UupTime').enable();//时间可用
         Ext.getCmp('imageDo').enable();//图片管理可用
         Ext.getCmp('Umid').setValue(record.get("MsgID"));
      Ext.getCmp('UmsgName').setValue(record.get("MsgName"));
      Ext.getCmp('UmsgKind').setValue(record.get("Mkid"));
      Ext.getCmp('UupTime').setValue(new Date(record.get("UpTime")));
      document.getElementById("mctext").value=record.get("Msg");
        }
    };

你可能感兴趣的:(iframe,function,layout,input,border,button)