How can I force Vaadin v8 to update the screen?

Valyrion picture Valyrion · Sep 30, 2011 · Viewed 44.5k times · Source

I have a small Vaadin v8 application that has several input fields (comboboxes, selectgroups, etc...). The content of most of these is determined by the chosen content of the first ComboBox. However, when I select something in it, all the others stay blank until I click one, at which point they all update. This is not desired behaviour, but I assume it's being caused by the server-side being up to date but not updating the client side view. (Even when adding requestRepaint() in my first Combobox's ValueChangeListener)

There must be some method to force Vaadin to get the data I want it to display even if no other components are clicked?

EDIT I'm not allowed to post answers to my own question so soon, so I'm putting it here temporarily:

I found that there's a javascript method that synchs client and server.

myComponent.getApplication().getMainWindow().executeJavaScript("javascript:vaadin.forceSync();");

The only problem I have now is that the ValueChangeListener on one of my comboboxes still only fires when I click another combobox (or the same one twice). It's the weirdest thing because the second combobox, when loaded, fires it's event perfectly.

Answer

Charles Anthony picture Charles Anthony · Sep 30, 2011

Is the first ComboBox in "immediate" mode?

If not, it probably should be : component.setImmediate(true).

See https://vaadin.com/book/-/page/components.selection.html