Reputation: 11
I have a GWT Dropdown listbox, which on a dropdown expands the dropdown list automatically to show long list items in FF and Chrome. IE however does not resize dynamically as a result the dropdown list shows chopped items.
Upvotes: 0
Views: 592
Reputation: 662
There is a way
listBox.addMouseDownHandler(new MouseDownHandler()
{
@Override
public void onMouseDown(MouseDownEvent event)
{
listBox.addStyleName("expand");
}
});
listBox.addBlurHandler(new BlurHandler()
{
@Override
public void onBlur(BlurEvent event)
{
listBox.removeStyleName("expand");
listBox.addStyleName("normal");
}
});
listBox.addChangeHandler(new ChangeHandler()
{
@Override
public void onChange(ChangeEvent event)
{
listBox.removeStyleName("expand");
listBox.addStyleName("normal");
}
});
.normal
{
width=200px;
}
.expand > option
{
width : auto;
}
In simple words set width to auto when viewing options else set it to default.
Upvotes: 1