1

I have a container with hbox layout. With a button I am adding another container with a button inside, the problem is that then the content never goes to second row, only stays in the first row. The main container has a fixed width, and is inside a window. How can I make this work? I would like it to work as 'break-word' does in css. Thanks for any help.

screenshoot: http://www.ohecollegeplanner.com/cp/img.png

getSelectedItemsCmp: function () {
    var items = [];

    var container = Ext.create("Ext.container.Container", {
        layout: "hbox",
        align: 'stretch',
        id: "tagContainer",
        height: 70,
        //flex:2,![enter image description here][1]
        overflowY: "auto",
        width: "400px",
        padding: 5
    });

    for (var i = 0; i < this.selectedItems.length; i++) {
        var tag = this.createSelectedItemsTag(this.selectedItems[i]);
        container.add(tag);

    }

    //container.doLayout();

    return container;
},
createSelectedItemsTag: function (obj) {
    var tag = {
        xtype: "container",
        id: "tag_" + obj.value,
        cls: "tagCompContainer",
        layout: {
            type: "hbox"
        },
        items: [{
            xtype: "label",
            text: obj.label,
            cls: "labelSelectedComps"
        }, {
            xtype: "button",
            text: "x",
            id: "tagbutton_" + obj.value,
            listeners: {
                click: {
                    fn: this.onDeleteSelectedCmpClick,
                    scope: this
                }
            }
        }

        ]
    };
    return tag;
},
2
  • Could you post some code and screenshots? Commented Jan 14, 2013 at 14:32
  • ok here is the code and image link... thanks for you help Commented Jan 14, 2013 at 14:43

1 Answer 1

2

What you are getting is exactly what hbox does...it distributes the items of the container horizontally. Maybe try using a table layout?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.