依据父页面的高度对Iframe中的表格的高度的调整

来源:互联网 发布:电脑拨号打电话软件 编辑:程序博客网 时间:2024/06/07 07:40

Ext.namespace('cms.SysConfig');


//缓冲Iframe中的Grid对象
var gSubIframeGrid=null;


cms.SysConfig.sysConfigfnPanel = function(config) {
 //
如果在继承时在override参数中定义了constructor方法,则子类不会继承父类在构造函数中定义的属性,
 //
但是可以继承在prototype中定义的属性,
 //
在这种情况下只有在constructor中调用父类的构造函数myClass.superclass.constructor.call(this,……;
 //
才会继承父类在构造函数中定义的对象。
 cms.SysConfig.sysConfigfnPanel.superclass.constructor.call(this, config);
};


Ext.extend(cms.SysConfig.sysConfigfnPanel, //子类名
           Ext.ux.BaseControl,//
父类名
   {                        //
子类的创建函数,存在就Override,不存在就create
     typeGrid:undefined,
     allPanel:undefined,
     code:undefined,
     getControl:function(){
      this.htmlPanel =new Ext.Panel({
                     code:this.code+"",
                     id:this.code, 
                       iconCls: 'tabs', 
                     html:"<iframe id='sysParamiframe' scrolling='auto' frameborder='0'width='100%' height='100%' src='/modules/SysConfig/sysinfo/sysConfig.jsp'></iframe>",
                      listeners : {
                           resize : function(comp,adjWidth, adjHeight, rawWidth, rawHeight) {
                      }.createDelegate(this)
       }
                       });



        this.allPanel =new Ext.Panel({
                    code:this.code+"",
                     title:"->
配置系统参数",
                    region:"center",
                 layout:"fit",
                    items:[this.htmlPanel],
                    listeners : {
                       afterLayout : function() {//
布局完成后调整表格的高度
                    
                        var task = { //Ext
的定时器,每隔1秒检测一次。 
                              run : function() {
                
                                  //
获取Ifframe中的Div对象
                                  //  var sysConfigGrid=Ext.get("sysParamiframe").dom.contentWindow.document.getElementById("sysConfigGridId");
       
                                    //
Iframe中访问父对象格式如下:self.parent.Ext.
                                     //
Iframe存在以下代码:
                                        //
Ext对象赋值给Iframe的父页面的变量 zhx
                                        //self.parent.gSubIframeGrid=sysConfigGrid;
       
                             if (gSubIframeGrid){//
布局完成了,但是Iframe还没有加载完,就不会执行的,定时检测,直到ifframe加载完成或异常发生退出定时器
                           try{
                                    gSubIframeGrid.setHeight(this.htmlPanel.getHeight());
                                         gSubIframeGrid.doLayout();
                           }catch(ex){
                                   alert(ex);
                          }
                          finally{
                                         Ext.TaskMgr.stop(task);//
加载完成,关闭定时器
                           }
                          }
                           }.createDelegate(this),  
                           interval : 1000  
                       }  
              Ext.TaskMgr.start(task);//
启动定时器
        
        }.createDelegate(this)
                }
               });
      return this.allPanel;
     }
 
 });


 



0 0
原创粉丝点击