2013-03-19 158 views
0

我的应用程序的布局非常复杂,使用的边框,vbox和hbox都很适合,除了一个烦恼之外。南部地区电网的底部不起作用。我想网格占用面板的高度时,浏览器上面了minHeight /最大化,但目前它是这样的:ExtJs网格高度和滚动条eurgh

enter image description here

而且当浏览器发生收缩(但不低于最小尺寸)它看起来像这样,我无法去网格滚动条:(底部

enter image description here

你可以看到(可能的最低高度上视/格的问题),但不能确定的滚动条切如何解决这个问题,有人可以发现我需要解决这两个问题吗?代码如下:

<script type="text/javascript" src="../app.js"></script> 
<!-- script to warn users when leaving page --> 
<?php 
$db = Zend_Registry::get('db'); 
$result = $db->query("select ERROR_ID, ERROR_DESCRIPTION, EMAIL_CONTENT, to_char(\"TIMESTAMP\", 'MM/DD/YYYY HH24:MI:SS') as TIMESTAMP, READ from PI_EMAIL_ERROR where \"TIMESTAMP\" = (select max(\"TIMESTAMP\") from PI_EMAIL_ERROR) and READ = 0 and rownum = 1")->FetchAll(); 
?> 
<script type="text/javascript"> 
    var container = Ext.create('Ext.container.Viewport',{ 
     id: 'mainWindow', 
     minWidth: 800, 
     minHeight: 640, 
     layout:'fit', 
     listeners: { 
      afterrender: function() { 
       this.setSize(this.getWidth(), this.getHeight());      
      }, 
      resize: function(){ 
       var programGrid = Ext.getCmp('programList'); 
       if(this.getHeight() < this.minHeight){ 
        console.log("Height: ", this.getHeight()); 
        console.log("minHeight: ", this.minHeight); 
        console.log("Grid old height: ", programGrid.height); 
        programGrid.height = (this.minHeight - programGrid.height)-18; 
        this.setSize(this.getWidth(), this.getHeight()); 
        console.log("Grid new height: ", programGrid.height); 
       } else { 
        programGrid.height = 380; 
       } 
      } 
     }, 
     defaults: { 
      //collapsible: true, //Add this to true later maybe impliment a lock sam 
      //when viewport scrolled up, background shows a login. 
      split: true, 
      rezisable: false 
     }, 
     items:[{ 
      layout: 'border', 
      //height: 640, 
      //minHeight: 640, 
      items: [ 
       { 
        //This panel holds the file menu strip and the show combo      
        border: false, 
        region: 'north', 
        height: 92, 
        bodyStyle:'background: #DFE8F6;', 
        /******Toolbar*******/ 
        tbar: [ 
        /****File Button****/ 
         { 
          xtype: 'button', 
          text: window.samlanguage.file, 
          width: 60, 
          handler: function(btn){ 

          }, 
          menu: [ 
           { 
            text: window.samlanguage.refreshlist, 
            action: 'refreshGrid', 
            icon: '../assets/images/refresh.png', 
            handler: function(btn){ 

            } 
           },{ 

            text: window.samlanguage.settings, 
            icon: '../assets/images/settings.png', 
            action: 'spawnSettings', 
            handler: function(Btn){ 
            } 
           },{ 

            text: window.samlanguage.compose, 
            icon: '../assets/images/mail--plus.png', 
            action: 'spawnEmail', 
            handler: function(Btn){ 
             Ext.create('APP.view.core.forms.Emailform').show(); 
            } 
           },{ 

            text: window.samlanguage.logout, 
            action: 'logout', 
            icon: '../assets/images/exit.png', 
            handler: function(){ 

            } 
           } 

          ] 
         }, 
        /****Help Button****/ 
         { 
          xtype: 'button', 
          text: window.samlanguage.help, 
          width: 60, 
          handler: function(btn){ 

          }, 
          menu: [ 
           { 
            text: window.samlanguage.contents, 
            icon: '../assets/images/contents.png', 
            action: 'spawnContents', 
            handler: function(btn){ 

            } 
           },{ 

            text: window.samlanguage.license, 
            icon: '../assets/images/licence.png', 
            handler: function(btn){ 
             var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"<b>Retrieving</b> licensing information..."}); 
             myMask.show(); 
             Ext.Ajax.request({ 
              url: '../License/read', 
              method: 'post', 
              //params: values, 
              success: function(response){ 
               myMask.hide(); 
               var numusers = Ext.decode(response.responseText); 
               Ext.create('APP.view.core.forms.License', {numusers: numusers.numusers}).show(); 

              } 
             }); 
            } 
           },{ 

            text: window.samlanguage.about, 
            icon: '../assets/images/about.png', 
            //action: 'spawnAbout', 
            handler: function(btn){ 
             Ext.Msg.show({ 
              title:'About us',             
              buttons: Ext.Msg.OK, 
              icon: 'perceptiveLogo' 
             }); 
            } 
           } 

          ] 
         } 
        ], 
        items: [{ 
         //Comboform with userlist 
         xtype: 'Comboform', 
         bodyStyle:'background: #DFE8F6;', 
         border: false 
        }] 

       }//End north region (header) region 
       ,{ 
        region:'center', 
        type: 'vbox', 
        align : 'stretch', 
        items: [ 
         { 
          //Add the userlist grid 
          title: 'Currently showing all users', 
          //id: 'usergridList', 
          height: 290, 
          minHeight: 290, 
          border: false, 
          xtype: 'Allusers' 
         }, 
         { 
          //Add the allprograms grid 
          title: 'Program Access Permissions', 
          border: false, 
          height: 380, 
          minHeight: 380, 
          //height: 'auto', 
          xtype: 'Allprograms' 
         } 
        ] 

       } //End center (body) region 
       ,{ 
        region:'east', 
        type: 'vbox', 
        align : 'stretch', 
        split: true, 
        //collapsible: true, 
        width: 240, 
        minWidth: 240, 
        maxWidth: 240, 
        //title: 'User Actions', 
        listeners: { 
         /*collapse: function() { 
         this.setTitle("User management"); 
         }, 
         expand: function() { 
         this.setTitle("User Actions"); 
         }, 
         click: function() { 
         return false; 
         },*/ 
         afterrender: function(){ 
          this.splitter.disable(); 
         } 
        }, 
        //height: 300 
        items :[ 
         { 
          title: 'User Actions', 
          border: false, 
          height: 168, 
          xtype: 'Useractionsform' 

         }, 
         { 
          title: 'View Audit', 
          border: false, 
          height: 122, 
          xtype: 'Auditform' 
         }, 
         { 
          title: 'Program Access', 
          border: false, 
          height: 380, 
          minHeight: 340, 
          xtype: 'Programactionsform' 
         } 
        ] 
       } //End of east region 
       ,{ 
        region: 'south', 
        height: 20, 
        bodyStyle:'background: #DFE8F6;', 
        border: false 
       } 

      ] 
     }] 
    }).show(); 
}); 
</script> 

语法高亮显示的链接: http://paste.laravel.com/kPr

太感谢您了 弥敦道

+0

可以使用设置一个jsfiddle的例子吗? – 2013-03-19 15:53:28

+0

我会尝试,但不知道它会工作得如何:) – Kal 2013-03-19 15:54:22

+0

我会先删除网格并用一个简单的面板替换它,以便您可以确定它是网格本身是否搞砸了事情,或者如果它只是你在某处布局配置搞砸了。 另外,我并不完全确定第87-97行视口的resize处理程序的目的是什么。 – zeke 2013-03-19 16:13:28

回答

1

我指的是行的语法高亮87-97您发布链接。

resize: function(){ 
     var programGrid = Ext.getCmp('programList'); 
     if(this.getHeight() < this.minHeight){ 
      console.log("Height: ", this.getHeight()); 
      console.log("minHeight: ", this.minHeight); 
      console.log("Grid old height: ", programGrid.height); 
      programGrid.height = (this.minHeight - programGrid.height)-18; 
      this.setSize(this.getWidth(), this.getHeight()); 
      console.log("Grid new height: ", programGrid.height); 
     } else { 
      programGrid.height = 380; 
     } 
    } 

这是视口的resize处理程序,所以每次浏览器调整大小时,此功能都将显式设置网格高度。不知道这段代码的目的是什么,但看起来可能是这个问题。一般来说,你不应该需要像这样的代码 - 如果你的布局设置正确,所有东西都应该合在一起,然后你可以使用minHeight/maxHeight作为网格。如果你只是把这个代码拿出来会发生什么?

+0

谢谢你,你是对的,补充说布局配置似乎解决了这个问题。这似乎是我没有正确调用vbox。 – Kal 2013-03-19 17:00:34