Need to select all text in filter ComboBox automatically

When a user tabs into filter ComoBox all of the text is automatically selected and the user can just start typing/filtering. When a user mouse clicks into a ComboBox they have to first manually select/highlight the text before they can start typing/filtering otherwise what they type just inserts into the current value/text.

What we would like to do is select all the text when the ComboBox gains focus from a mouse click but there’s doesn’t appear to be an easy way to do this. There’s a focus listener but no text selection methods. We had hoped for a method like the TextField control’s selectAll() or setSelectionRange() methods.

Any suggestions?

Hi,

Currently the only way to get such functionality is to do modifications to the client-side code of ComboBox.

There is an enhancement ticket about the issue:
#7116 Clicking Combobox should select the text
.

-Henri

As in ticket , i see the solution of setSelectTextOnClick(boolean selectTextOnClick)… But not able to see this function working .is there any adon ? kindly help.I am using vaadin 6.8

It seems that there is still no simple way to setting ‘selectAll’ on click (focus) for a combobox server-component.
However I need to implement such functionality.
What would be the best approach to achieve this?

I have achieved the ability to clear a combobox filter field, but it does not seem to work fine and I am not satisfied with just clearing it.
Here is what I got:

comboBox.addFocusListener(event -> {
    comboBox.setValue(null);
    comboBox.markAsDirty();
});