Reputation: 77
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;
},
Upvotes: 1
Views: 5620
Reputation: 3114
What you are getting is exactly what hbox does...it distributes the items of the container horizontally. Maybe try using a table layout?
Upvotes: 2