Announcement
Collapse
No announcement yet.
X
-
Use hint+showHintInField instead. Those emptyDisplayValue APIs really apply more to SelectItem and other FormItems that don't have an interactive text input area.
Leave a comment:
-
ComboBoxItem not clearing empty display value
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?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 Last edited by ellisd5; 3 Feb 2016, 03:05.Tags: None
Leave a comment: