Hi all,
I have a ComboBoxItem with the empty display set to "-- Please Select --" However when I click on the box to filter the results the empty display values is set as the filter and you have to manually clear the value so that you can start typing allowing you to utilize the filtering.
This is my work around for the issue...
Is there a better way to implement this?
Thanks,
Dale
I have a ComboBoxItem with the empty display set to "-- Please Select --" However when I click on the box to filter the results the empty display values is set as the filter and you have to manually clear the value so that you can start typing allowing you to utilize the filtering.
This is my work around for the issue...
Code:
final ComboBoxItem selectItem = (ComboBoxItem) formItem; selectItem.setAllowEmptyValue(true); selectItem.setEmptyDisplayValue("-- Please Select --"); selectItem.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent focusEvent) { if (selectItem.getValue() == null) { selectItem.setAttribute(ORIGINAL_EMPTY_DISPLAY_VALUE, selectItem.getEmptyDisplayValue()); selectItem.setEmptyDisplayValue(""); selectItem.redraw(); selectItem.showPicker(); } } }); selectItem.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent blurEvent) { selectItem.setEmptyDisplayValue(selectItem.getAttribute(ORIGINAL_EMPTY_DISPLAY_VALUE)); selectItem.redraw(); } });
Thanks,
Dale
GWT Version : | 2.7.0 |
SmartGWT Version : | 5.0p |
SmartGWT Build Date : | 02/07/2015 08:14 |
Comment