// shown in unfocused empty field, disappears on focus (e.g "Search here")
private String emptyText = "";
+ // Set true when popupopened has been clicked. Cleared on each UIDL-update.
+ // This handles the special case where are not filtering yet and the
+ // selected value has changed on the server-side. See #2119
+ private boolean popupOpenerClicked;
private static final String CLASSNAME_EMPTY = "empty";
private static final String ATTR_EMPTYTEXT = "emptytext";
optionUidl);
currentSuggestions.add(suggestion);
if (optionUidl.hasAttribute("selected")) {
- if (!filtering) {
+ if (!filtering || popupOpenerClicked) {
tb.setText(suggestion.getReplacementString());
selectedOptionKey = "" + suggestion.getOptionKey();
}
captions += suggestion.getReplacementString();
}
- if (!filtering && uidl.hasVariable("selected")
+ if ((!filtering || popupOpenerClicked) && uidl.hasVariable("selected")
&& uidl.getStringArrayVariable("selected").length == 0) {
// select nulled
tb.setText(emptyText);
DOM.setStyleAttribute(spacer, "overflow", "hidden");
DOM.appendChild(panel.getElement(), spacer);
+ popupOpenerClicked = false;
+
}
public void onSuggestionSelected(FilterSelectSuggestion suggestion) {
// auto close feature
if (!suggestionPopup.isJustClosed()) {
filterOptions(-1, "");
+ popupOpenerClicked = true;
lastFilter = "";
}
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
import com.itmill.toolkit.Application;
import com.itmill.toolkit.data.Property;
import com.itmill.toolkit.data.util.ObjectProperty;
+import com.itmill.toolkit.terminal.ExternalResource;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.Layout;
// If no window found, create it
w = createWindow();
addWindow(w);
+ w.open(new ExternalResource(w.getURL()));
}
return w;
}