Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
ValueChangeEvent - origin?
Hello,
I'm trying to use a table in order to display a list of records in a database table. Some of the columns of the table are editable and data can be saved. I've tried a ValueChangeListener by adding it to the field in a DefaultFieldFactory derived class. Unfortunately this event gets fired even when the table gets loaded. My question: how can I tell who instigated the change - was loading data from the container or was it the user editing something?
Br, Georgi
boolean save = false;
Valuechangelistener -> if(save) { do sth; save = false; }
this will make the Valuechangelistener to do nothing when the table is being loaded, then u need a way to turn save = true again.
Valuechangelistener can show u when the Value is changed (table loading) or when the user is focusing a field or losing the focus of it. Textchangelistener (if this is possible for the table) is triggered right before a user actually edits the input of a field. I did this things with Table+TextFields, so I dont know if it will work for you with just an editable table. But as long as u can use a Valuechangelistener and a Textchangelistener it should work for u.
I starts my ValueChangeListener with:
if (!((AbstractField) event.getProperty()).isAttached()){
return;
}
Than the action is not performed until the table is displayed.