Search code examples
layoutextjsextjs4flowlayout

How to implement a flowlayout in ExtJS 4?


I want to use a layout where components are added horizontally like hbox but where upon adding if the component exceed the bounds of the container it is moved to the next line. This is similar to what FlowLayout is in swing and flex.

I couldn't find any layout in ExtJS 4.0 that would achieve this.

So I am wondering how I would go about doing this. I am fairly new to the framework so any pointers would be great.


Solution

  • Have you tried using ColumnLayout? If you don't specify the "columnWidth" properties, the child elements are css-floated from left to right:

     Ext.create('Ext.Panel', {
            width: 500,
            height: 280,
            title: "ColumnLayout Panel",
            layout: 'column',
            renderTo: document.body,
            items: [{
                xtype: 'panel',
                title: 'First Inner Panel',
                width:  250,
                height: 90
            },{
                xtype: 'panel',
                title: 'Second Inner Panel',
                width: 200,
                height: 90
            }, {
                xtype: 'panel',
                title: 'Third Inner Panel',
                width: 150,
                height: 90
            }]
      });
    

    enter image description here