dynamic add items to border viewport
I want to create a empty viewport(layout:border) first, then add items to it, finally render and show. but when I created the viewport element, it throw an error, says:
Uncaught TypeError: Cannot read property 'flex' of undefined
here are my code:
<script type="text/javascript" src="ext-4.0.2a/bootstrap.js"></script>
<script>
Ext.require(['*']);
Ext.onReady(function()开发者_运维技巧 {
Ext.QuickTips.init();
var viewport = Ext.create('Ext.container.Viewport', {
layout: 'border'
});
var north = blablabla...
viewport.add([north,south]);
viewport.doLayout();
});
</script>
According to notes that are taken from docs:
The regions of a BorderLayout are fixed at render time and thereafter, its child Components may not be removed or added.To add/remove Components within a BorderLayout, have them wrapped by an additional Container which is directly managed by the BorderLayout.
And by the way
Any Container using the Border layout must have a child item with region:'center'
精彩评论