问题描述
new Ext.Viewport({ layout: 'border', items: [{ region: 'north', html: '<h1 class="x-panel-header">Page Title</h1>', autoHeight: true, border: false, margins: '0 0 5 0' }, { region: 'west', collapsible: true, title: 'Navigation', width: 200 // the west region might typically utilize a TreePanel or a Panel with Accordion layout }, { region: 'south', title: 'Title for Panel', collapsible: true, html: 'Information goes here', split: true, height: 100, minHeight: 100 }, { region: 'east', title: 'Title for the Grid Panel', collapsible: true, split: true, width: 200, xtype: 'grid', // remaining grid configuration not shown ... // notice that the GridPanel is added directly as the region // it is not "overnested" inside another Panel }, { region: 'center', xtype: 'tabpanel', // TabPanel itself has no title items: [grid1,grid2] }]});如上代码,我需要在center区域动态的添加grid3,这个怎么实现? 问题补充:lizhi92574 写道
解决方案
var center = vi.items.get(vi.items.length-1); //通过 Viewport 获取center区域组件center.add(grid3);center.doLayout();
解决方案二:
楼上正解