调用 items.add 方法两次会导致两个项目在卡片上重叠

发布于 2024-12-06 10:35:47 字数 390 浏览 0 评论 0原文

这是我的添加项目代码:

myapp.cards.vehicleInfo.items.add(
       new Ext.List({ ...})
)

如果在此之后我执行以下操作:

myapp.cards.vehicleInfo.items.add(
        new Ext.Panel(
        {html: 'test' }
        )
    );

带有“测试”的面板出现在我的列表顶部(重叠),而不是垂直位于其下方。我尝试在添加这两个项目之间进行组件布局。

有什么想法吗?如果我只执行上述其中一项,它会按预期工作,但如果我同时执行两项操作,则会导致上述行为。

谢谢

Here is my add item code:

myapp.cards.vehicleInfo.items.add(
       new Ext.List({ ...})
)

If after this I then do:

myapp.cards.vehicleInfo.items.add(
        new Ext.Panel(
        {html: 'test' }
        )
    );

The panel with 'test' appears on top of my list (overlapping), rather than vertically below it. I have tried doing a componenet dolayout inbetween adding the two items.

Any ideas? If I only do one or the other of the above it works as expected but if I do both together it leads to the above behaviour.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

筱果果 2024-12-13 10:35:47

您应该将面板停靠在底部。

myapp.cards.vehicleInfo.dockedItems.add( new Ext.Panel(
    {html: 'test' }
    )
);

更新

Ext.regModel('Contact', {
    fields: ['firstName', 'lastName']
});

var store1 = new Ext.data.JsonStore({
    model  : 'Contact',
    data: [
        {firstName: 'Tommy',   lastName: 'Maintz'},
        {firstName: 'Rob',     lastName: 'Dougan'},
        {firstName: 'Ed',      lastName: 'Spencer'},
        {firstName: 'Jamie',   lastName: 'Avins'},
        {firstName: 'Aaron',   lastName: 'Conran'},
        {firstName: 'Dave',    lastName: 'Kaneda'},
        {firstName: 'Michael', lastName: 'Mullany'},
        {firstName: 'Abraham', lastName: 'Elias'},
        {firstName: 'Jay',     lastName: 'Robinson'},
        {firstName: 'Tommy',   lastName: 'Maintz'},
        {firstName: 'Rob',     lastName: 'Dougan'},
        {firstName: 'Ed',      lastName: 'Spencer'},
        {firstName: 'Jamie',   lastName: 'Avins'},
        {firstName: 'Aaron',   lastName: 'Conran'},
        {firstName: 'Dave',    lastName: 'Kaneda'},
        {firstName: 'Michael', lastName: 'Mullany'},
        {firstName: 'Abraham', lastName: 'Elias'},
        {firstName: 'Jay',     lastName: 'Robinson'}
    ]
});

new Ext.Application({
    launch: function() {
       var panel =  new Ext.Panel({
            fullscreen: true,
            id:'thePanel',
            layout: 'vbox',
            style: 'background-color:darkblue',
            scroll:'vertical'
        });
//do this in your dynamically called function
    var list = new Ext.List({
        id :'theList',
        itemTpl : '{firstName} {lastName}',
        store: store1,
        width: '100%',
        scroll:false
    });


var smallPanel = new Ext.Panel({layout: 'auto',width:'100%',height:200,style:'background-color:darkgreen;color:white',html:"Hello I'm the panel"});
    panel.items.add(list);
    panel.items.add(smallPanel);
    panel.doLayout();               
    }
});

You should dock the panel to the bottom.

myapp.cards.vehicleInfo.dockedItems.add( new Ext.Panel(
    {html: 'test' }
    )
);

Update

Ext.regModel('Contact', {
    fields: ['firstName', 'lastName']
});

var store1 = new Ext.data.JsonStore({
    model  : 'Contact',
    data: [
        {firstName: 'Tommy',   lastName: 'Maintz'},
        {firstName: 'Rob',     lastName: 'Dougan'},
        {firstName: 'Ed',      lastName: 'Spencer'},
        {firstName: 'Jamie',   lastName: 'Avins'},
        {firstName: 'Aaron',   lastName: 'Conran'},
        {firstName: 'Dave',    lastName: 'Kaneda'},
        {firstName: 'Michael', lastName: 'Mullany'},
        {firstName: 'Abraham', lastName: 'Elias'},
        {firstName: 'Jay',     lastName: 'Robinson'},
        {firstName: 'Tommy',   lastName: 'Maintz'},
        {firstName: 'Rob',     lastName: 'Dougan'},
        {firstName: 'Ed',      lastName: 'Spencer'},
        {firstName: 'Jamie',   lastName: 'Avins'},
        {firstName: 'Aaron',   lastName: 'Conran'},
        {firstName: 'Dave',    lastName: 'Kaneda'},
        {firstName: 'Michael', lastName: 'Mullany'},
        {firstName: 'Abraham', lastName: 'Elias'},
        {firstName: 'Jay',     lastName: 'Robinson'}
    ]
});

new Ext.Application({
    launch: function() {
       var panel =  new Ext.Panel({
            fullscreen: true,
            id:'thePanel',
            layout: 'vbox',
            style: 'background-color:darkblue',
            scroll:'vertical'
        });
//do this in your dynamically called function
    var list = new Ext.List({
        id :'theList',
        itemTpl : '{firstName} {lastName}',
        store: store1,
        width: '100%',
        scroll:false
    });


var smallPanel = new Ext.Panel({layout: 'auto',width:'100%',height:200,style:'background-color:darkgreen;color:white',html:"Hello I'm the panel"});
    panel.items.add(list);
    panel.items.add(smallPanel);
    panel.doLayout();               
    }
});
ˇ宁静的妩媚 2024-12-13 10:35:47

您应该检查要添加面板的容器中的布局选项。上周我遇到了同样的问题,并将布局属性设置为布局:{type:'vbox',align:'stretch'}为我提供了一个很好的一列布局。我不确定这是否是问题所在,但无论如何请尝试一下:)

You should check the layout option in the container to which you are adding Panels. I've had the same issue last week, and seting layout property to layout : {type : 'vbox', align : 'stretch' } provided me with a nice one column layout. I'm not sure if this is the issue, but try it anyway:)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文