问题
The data in SPA should be updated periodically to show the current db state in the table. I'm trying to do it by the click event on a table row.
table.addListener(
new Table.ValueChangeListener() {
public void valueChange(final ValueChangeEvent event) {
BeanItemContainer<Incoming> bic;
Query query = sess.createQuery("...");
List l = query ...
bic = new BeanItemContainer<Incoming>(l);
table.setContainerDataSource(bic);
}
}
);
But at this line the cursor is lost:
table.setContainerDataSource(bic);
How can I keep cursor on row when data is updated?
回答1:
With your current approach, I would do :
...
Object selection = table.getValue();
bic = new BeanItemContainer<Incoming>(l);
table.setContainerDataSource(bic);
table.setValue(selection);
...
来源:https://stackoverflow.com/questions/13043152/how-to-keep-cursor-on-row-when-data-is-updated