Flow layout with nested container

﹥>﹥吖頭↗ 提交于 2019-12-11 02:07:00

问题


In my Ext JS 6 app, I'm trying to create a flow layout with 3 containers, with the middle container having nested items that need to continue with the flow layout. I can get this working if I add the middle container's items directly, but I don't want to do that... I want them to be separate.

Here's an example:

Ext.application({
    name: 'Fiddle',

    launch: function () {
        Ext.create('Ext.panel.Panel', {
            height: 300,
            width: 300,
            scrollable: true,
            renderTo: Ext.getBody(),
            title: 'Not properly working',
            bodyPadding: 10,
            layout: {
                type: 'column'
            },
            items: [{
                xtype: 'panel',
                title: 'start',
                width: 100,
                height: 50
            }, {
                xtype: 'container',
                defaults: {
                    xtype: 'panel',
                    title: '1',
                    width: 50,
                    height: 50,
                    style: 'float: left;'
                },
                items: [{}, {}, {}, {}, {}, {}]
            }, {
                xtype: 'panel',
                title: 'end',
                width: 100,
                height: 50
            }]
        });
        Ext.create('Ext.panel.Panel', {
            height: 300,
            width: 300,
            scrollable: true,
            renderTo: Ext.getBody(),
            bodyPadding: 10,
            title: 'This is how it should look',
            layout: {
                type: 'column'
            },
            items: [{
                xtype: 'panel',
                title: 'start',
                width: 100,
                height: 50
            }, {
                xtype: 'panel',
                title: '1',
                width: 50,
                height: 50
            }, {
                xtype: 'panel',
                title: '1',
                width: 50,
                height: 50
            }, {
                xtype: 'panel',
                title: '1',
                width: 50,
                height: 50
            }, {
                xtype: 'panel',
                title: '1',
                width: 50,
                height: 50
            }, {
                xtype: 'panel',
                title: '1',
                width: 50,
                height: 50
            }, {
                xtype: 'panel',
                title: '1',
                width: 50,
                height: 50
            }, {
                xtype: 'panel',
                title: 'end',
                width: 100,
                height: 50
            }]
        });
    }
});

So my flow layout should look like this (depicted in the example's 2nd panel):

start 1 1 1 (newline)
1 1 1 end

I got the idea from this thread, but that doesn't have a nested item like in my example. Also tried to use this thread's advice, but still no dice.

I think the issue is with the auto layout for the middle container, as it sets the width to 100% for its child div, but I'm not sure how to fix this... any advice?

来源:https://stackoverflow.com/questions/40899823/flow-layout-with-nested-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!