Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

ChangedHandler called multiple times during setValue

$
0
0
Dear Isomorphic,

We are using SmartGWT version v8.3p_2013-08-13/Pro Deployment (built 2013-08-13)

When I register a ChangedHandler to a MultiComboboxItem and change the value programatically via setValues multipse event are sent even though the value is changed only once. For example in this case:

public class SmartGwtSandbox implements EntryPoint {

public void onModuleLoad() {

SC.showConsole();
DynamicForm testForm = new DynamicForm();
final MultiComboBoxItem comboBox = new MultiComboBoxItem();
comboBox.setTitle("Choose a number");
comboBox.setTitleOrientation(TitleOrientation.TOP) ;
comboBox.setValueMap("1", "2", "3");
testForm.setFields(comboBox);
RootPanel.get().add(testForm);
HandlerRegistration handler = comboBox.addChangedHandler(new ChangedHandler() {

public void onChanged(ChangedEvent event) {
String result = "";
for (String s : comboBox.getValues()) {
result += s + " ";
}

SC.logWarn("Value changed to:" + result + " event.getValue()" + event.getValue());

}
});
comboBox.setValues(new String[] { "1", "2" });
}
}

The log contains the following 3 entries, it seems that the control is deleted, and then the values are added one by one:

16:16:54.318:WARN:Log:Value changed to: event.getValue()
16:16:54.360:WARN:Log:Value changed to:1 event.getValue()1
16:16:54.399:WARN:Log:Value changed to:2 1 event.getValue()2,1

Although setValues really called only once.

Is it the right behavior? If yes, is there a way to omit ChangedEvents which are not "final" in this sense, and get the event with the "real" final value only?

Thanks in advance!
Attila Tóth

Viewing all articles
Browse latest Browse all 4756

Trending Articles