Wayne
Wayne

Reputation: 77

Vaadin 14 NumberField isEditting?

Is there a way to tell if a field is being EDITED in Vaadin? I have a feed that updates some spinners, and wish the user ability to change values and not have system update till after the changeEvent is fired.

Regards.

Upvotes: 0

Views: 55

Answers (1)

ollitietavainen
ollitietavainen

Reputation: 4275

I think you might benefit from a slightly different approach. Any value change events have the property isFromClient, which you can use to distinguish events from the real user and value changes that occur as a result of the server-side code updating the field.

        textField.addValueChangeListener(valueChangeEvent -> {
           if (!valueChangeEvent.isFromClient()) {
               // value updated from server -> do nothing
               return;
           }
           // user changed the value, this time we want to react to it
        });

Upvotes: 1

Related Questions