ExtJS Tab里放Grid高度自适应问题,官方Perfect方案。

出处:http://docs.sencha.com/extjs/4.2.1/extjs-build/examples/layout-browser/layouts/combination.js

// A common mistake when adding grids to a layout is creating a panel first,
// then adding the grid to it. GridPanel (xtype:'grid') is a Panel subclass,
// so you can add it directly as an item into a container. Typically you will
// want to specify layout:'fit' on GridPanels so that they'll size along with
// their container and take up the available space.

 

大致意思是Grid是Panel的子类,不需要用Panel再包Grid了,这样做的话,会导致Grid的Fit布局,不能奏效了。

示例页面:http://docs.sencha.com/extjs/4.2.1/extjs-build/examples/layout-browser/layout-browser.html

选左边树上的Combination Examples下的Tabs With Nested Layouts

选Foo页的Inner Tab 2,这下边有个“下置标签选项卡”,再选择“Nested Grid”,就能Grid自适应的效果。

 

注意:因为Panel有closable属性,Grid是子类,当然也有啦。原来Grid也是可以“关闭”的啊!

posted @ 2013-07-24 15:05  任国强  阅读(2630)  评论(0编辑  收藏  举报