19
19
import com .arcbees .chosen .client .SelectParser .OptionItem ;
20
20
import com .arcbees .chosen .client .event .MaxSelectedEvent ;
21
21
import com .google .gwt .dom .client .OptionElement ;
22
+ import com .google .gwt .dom .client .SelectElement ;
22
23
import com .google .gwt .query .client .GQuery ;
23
24
import com .google .gwt .user .client .Event ;
25
+ import com .google .web .bindery .event .shared .EventBus ;
24
26
25
27
public class MobileMultipleChosenImpl extends AbstractMobileChosenImpl {
26
28
@ Override
@@ -48,6 +50,7 @@ protected void addChoice(OptionItem item) {
48
50
}
49
51
}
50
52
53
+ @ Override
51
54
protected void resultDeactivate (GQuery query , boolean selected ) {
52
55
if (!selected ) {
53
56
super .resultDeactivate (query , selected );
@@ -87,6 +90,13 @@ protected void update() {
87
90
closeField ();
88
91
}
89
92
93
+ @ Override
94
+ protected void init (SelectElement element , ChosenOptions options , EventBus eventBus ) {
95
+ super .init (element , options , eventBus );
96
+
97
+ updateSelectedText ();
98
+ }
99
+
90
100
private void resultDeselect (OptionItem item , GQuery element ) {
91
101
choices --;
92
102
@@ -111,8 +121,10 @@ private void updateSelectedText() {
111
121
String selectedText ;
112
122
if (choices > 1 ) {
113
123
selectedText = getOptions ().getManySelectedTextMultipleMobile ();
114
- } else {
124
+ } else if ( choices == 1 ) {
115
125
selectedText = getOptions ().getOneSelectedTextMultipleMobile ();
126
+ } else {
127
+ selectedText = defaultText ;
116
128
}
117
129
118
130
selectedText = selectedText .replace ("{}" , "" + choices );
0 commit comments