extjs - dynamic add items to border viewport - Stack Overflow

I want to create a empty viewport(layout:border) first, then add items to it, finally render and show.

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>

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>
Share Improve this question edited Jul 31, 2011 at 16:17 Chau 5,5709 gold badges67 silver badges99 bronze badges asked Jul 29, 2011 at 13:38 missingcat92missingcat92 1,2262 gold badges14 silver badges23 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

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'

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745215658a4617004.html

相关推荐

  • extjs - dynamic add items to border viewport - Stack Overflow

    I want to create a empty viewport(layout:border) first, then add items to it, finally render and show.

    8小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信