最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

extjs - dynamic add items to border viewport - Stack Overflow

programmeradmin1浏览0评论

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'

发布评论

评论列表(0)

  1. 暂无评论