ExtJS Tab裡放Grid高度自適應問題,官方Perfect方案。

rgqancy發表於2013-07-24

出處: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也是可以“關閉”的啊!

相關文章