Search code examples
javagwtcomboboxmultilinegxt

Multiline items in ExtGWT ComboBox dropdown list


I can't manage to make the contents of my combobox' dropdown list wrap properly. I'm doing this:

private native String getTemplate() /*-{
return [ 
    '<tpl for=".">',
    '<div class="x-combo-list-item" style="width: 450px;">',
    '{id}<br />{name}</div>',
    '</tpl>'
    ].join("");
}-*/;

It doesn't seem to work, the contents of the list keep overflowing the div and the rest of the string becomes hidden. And although <br> works, such a "solution" isn't really acceptable. I already tried to add various overflow-ish css styles to my div, tried to add a table, nothing works. Any ideas?

Update: i also tried to make a nested <div> within "x-combo-list-item", but in this case i can't select an item at all. comboBox.setItemSelector("x-combo-list-item") doesn't help.


Solution

  • Apparently I found an answer: you need to explicitly state the tag kind in setItemSelector as in comboBox.setItemSelector("div.x-combo-list-item");. Works great in that case.