ComboBox ValueChangeListener

I only get ValueChangeListener callbacks after clicking on the comboBox a second time after selecting a value. Does this make sense?

    VerticalLayout content = new VerticalLayout();
    setContent(content);
    final ComboBox comboBox = new ComboBox("Test", Lists.newArrayList("A", "B", "C"));
    content.addComponent(comboBox);
    comboBox.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            System.out.println("Value changed to " + valueChangeEvent.getProperty().getValue());
        }
    });

Yea that’s the expected behaviour. Some components queue up events to save a server roundtrip. For example it - apparently - is not deemed necessary to send a request to the server every time the user changes a selection in the combobox. For other components like buttons events will always be sent.

You can change that behaviour with calling “comboBox.setImmediate(true)”. This will instruct the combobox to send out events immediatly as the occur. The same works for many other components.