How to keep cursor on row when data is updated?(如何在数据更新时将游标保持在行上?)
问题描述
应定期更新SPA中的数据,以显示表中的当前数据库状态。我正在尝试通过表行上的单击事件来执行此操作。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);
}
}
);
但在此行光标丢失:
table.setContainerDataSource(bic);
如何在更新数据时将游标保持在行上?
推荐答案
使用您目前的方法,我会这样做:
...
Object selection = table.getValue();
bic = new BeanItemContainer<Incoming>(l);
table.setContainerDataSource(bic);
table.setValue(selection);
...
这篇关于如何在数据更新时将游标保持在行上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!