Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Refresh generated columns after change in editable table
I am using a table with a BeanItemContainer, a FieldFactory and a ColumnGenerator. The table is set to immediate, selectable and editable.
One of the columns contains a select.
One of the generated columns displays a text which depends on the selection in the select.
What I want to get is that the text in the generated column changes immediately if the user changes the value of the select.
I already get informed (using PropertyChangeSupport in my bean) if the selection changes. But the text in the generated columns only changes if the table is repainted as "generateCell" of my ColumnGenerater ist called only in this case. A manually table.requestRepaint() does not cause a repaint.
I found a tricky solution by extending BeanItemContainer to get access to the protected method "fireItemSetChange" which I can call in the ValueChangeListener of the select. This actually causes the table to be repainted. But this causes a big problem when editing the table columns: I get periodically an error because my Application is "Out of sync" (Log shows "Ignoring variable change for non-existent component, ..."). Therefore this is a bad solution for me!
So is the another way causing the generated column to refresh?
your tip works for me as a replacement for my "hack" with "fireItemSetChange". Thanx for it.
My "Out of sync" problem was unfortunately not solved. Finally I solved this by moving refreshRowTable() from the selects ValueChangeListerner to the beans PropertyChangeListener.
Thank you very much for your support!
Can you please attach source code..I've similar problem...It will be of great help...
Have you solved it? I have the same problem... :bashful:
Removing the items from the table and adding them;
and then calling refreshRowCache and RequestRepaint doesn't work for me.