Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Error refreshing Table without changing the focus
I suppose that is a recurrent question but I don't understand what happend I'll explain the problem with this pseudocode. I'm using Vaadin 7.4.6 and a selected table with a BeanItemContainer and a collection of pojos:
1) Query all beans and create a BeanItemContainer and set the data container to my Selected Table (OK):
// create the BeanItemContainer with data
BeanItemContainer<MyBean> myContainer = new BeanItemContainer<MyBean>(MyBean.class);
// Bind Table with my BeanItemContainerd filled
1) Select a bean from table:
MyBean myBean = (MyBean)myTable.getValue(); (OK)
2) Edit myBean with a Form change something, persist and refresh BeanItemContainer and Table (OK)
int position = myContainer.indexOfId(myBean);
MyBean myBeanSaved = myBeanService.save(myBean);
3) Without change the focus in my Table (maintain the same position) select again the same item from table, the item is not the myBeanSaved it's the oldBean, that is the bean with tha atributes changed but in memory the id is the old one.
MyBean myBean = (MyBean)myTable.getValue(); (BAD)
4) If change the focus of the item from my table, select other item and again select the edited item, and edit again now the item selected is right, that is the memory id is correct (OK)
I must change the focus of the table to propagate the BeanItemContainer to the selected table, Why?, what is wrong??