21. Ext中表格自适应高度

转自:https://blog.csdn.net/happy492/article/details/6401099

1.

下面的代码中width和height的初始值为tab的开始大小,当浏览器窗口变化时,通过monitorResize监听,doLayout进行重新计算,document.body.clientHeight浏览器页面高度(浏览器除去工具栏,菜单栏。。。的面积),205为自己系统中左侧菜单的宽度,140为系统界面top的高度。如此变能实现随浏览器的变化表格的高度能自动收缩。

1      Ext.getCmp('mainTab').getActiveTab().getInnerWidth(),  
2                 height: Ext.getCmp('mainTab').getActiveTab().getInnerHeight(),  
3                 /**表格高度自适应 document.body.clientHeight浏览器页面高度 start**/  
4                 monitorResize: true,   
5                 doLayout: function() {   
6                     this.setWidth(document.body.clientWidth-205);  
7                     this.setHeight(document.body.clientHeight-140);  
8                     Ext.grid.GridPanel.prototype.doLayout.call(this);   
9                 }  
原文地址:https://www.cnblogs.com/sharpest/p/7568798.html