kveeiv / extjs-boxselect

Ext.ux.form.field.BoxSelect
http://kveeiv.github.com/extjs-boxselect/examples/boxselect.html
MIT License
108 stars 53 forks source link

Input element doesn't go to another line if no space left #29

Open twinssbc opened 11 years ago

twinssbc commented 11 years ago

If the tags happen to occupy the whole line (no more, no less), I think the width of the input element should be the whole itemList width, so that the input can go to another line. But the actual input element width is 0, so nothing can be inputted.

According to the method "publishInnerWidth" in Ext.ux.layout.component.field.BoxSelectField,

publishInnerWidth:function(ownerContext) {
    var me = this,
        owner = me.owner,
        width = owner.itemList.getWidth(true) - 10,
        lastEntry = owner.inputElCt.prev(null, true);

    if (lastEntry && !owner.stacked) {
        lastEntry = Ext.fly(lastEntry);
        width = width - lastEntry.getOffsetsTo(lastEntry.up(''))[0] - lastEntry.getWidth();
    }

    if (!me.skipInputGrowth && (width < 35)) {
        width = width - 10;
    } else if (width < 1) {
        width = 1;
    }
    ownerContext.inputElCtContext.setWidth(width);
}

The width will be negative, so the input element width will be 0. Probably change it to the below lines? Thanks!

   if (!me.skipInputGrowth && (width < 35)) {
        width = {itemListWidth} - 10;
    }