0

I am having a multi row single column table which is to be populated from a List<String>. And this List<String> is populated via a modal window and when ever there is an update in this List<String> the table has to be updated.

How do I achieve this through Vaadin?

Any pointers or examples on this would be greatly helpful.

Thanks

g0c00l.g33k
  • 2,458
  • 2
  • 31
  • 41
  • You could hold a reference to the window, add a `Window.CloseListener` and when the window gets closed, you retrieve the modified list and update the table. – Morfic Sep 02 '14 at 07:38
  • @Morfic Thanks, yes I am getting the value from Modal the way you suggested but the issue is is in updating the table. I am unable to update it for some reason :( – g0c00l.g33k Sep 02 '14 at 07:39
  • you are mentioning push in your tags: is this all done by one user in one session? – cfrick Sep 02 '14 at 07:40
  • @g0c00l.g33k then please post some code so we can better understand the scenario, or share a link if it's on github or similar – Morfic Sep 02 '14 at 07:44

1 Answers1

3

you could use the same container for both the field to edit and the table to display. be sure to either fire your refreshes manually (https://www.vaadin.com/api/com/vaadin/ui/Table.html#refreshRowCache()) or listen for them (https://www.vaadin.com/api/com/vaadin/data/Container.ItemSetChangeListener.html)

cfrick
  • 35,203
  • 6
  • 56
  • 68
  • You're right. Actually, the OP *should* use a container (e.g. BeanItemContainer in this case) and use the same container instance for both tables. Then, it will not be necessary to manually update either table, since the Table component internally handles changes to its underlying data component. All that given that the OP doesn't want to synchronize two different UI instances with Vaadin Push... – Roland Krüger Sep 09 '14 at 06:05