From 2a2436ecebc7eb490e7bbe34f62d975a60219f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20M=C3=A9riouma-Caron?= Date: Tue, 2 Feb 2016 14:36:59 -0500 Subject: [PATCH] Fix for #285 : ChosenValueListBox allowSingleDeselect not working as expected --- .../com/arcbees/chosen/client/ChosenImpl.java | 26 ++++++++++++------- .../chosen/client/gwt/ChosenListBox.java | 9 ++++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/plugin/src/main/java/com/arcbees/chosen/client/ChosenImpl.java b/plugin/src/main/java/com/arcbees/chosen/client/ChosenImpl.java index e850e2a..7c8d93c 100644 --- a/plugin/src/main/java/com/arcbees/chosen/client/ChosenImpl.java +++ b/plugin/src/main/java/com/arcbees/chosen/client/ChosenImpl.java @@ -92,7 +92,6 @@ public abstract class ChosenImpl { protected GQuery searchContainer; protected String defaultText; private GQuery $selectElement; - private boolean allowSingleDeselect; private GQuery container; private String containerId; private ChosenCss css; @@ -594,9 +593,7 @@ protected void fireChosenChangeEventIfNotEqual(OptionItem item, String newValue, protected void addChoice(OptionItem item) { selectedItem.find("span").text(item.getText()); - if (allowSingleDeselect) { - singleDeselectControlBuild(); - } + singleDeselectControlBuild(); selectedValues.clear(); } @@ -859,6 +856,13 @@ private boolean containerMouseUp(Event e) { return true; } + private SafeHtml createEmptyOption() { + SafeHtmlBuilder builder = new SafeHtmlBuilder(); + builder.append(fromTrustedString("")); + + return builder.toSafeHtml(); + } + private SafeHtml createOption(OptionItem item) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(fromTrustedString("