Removing rows from Table bound to BeanItemContainer

I’m using vaadin 6.4.9 with Scala

tblDocuments is Table, docs is BeanItemContainer. I have a button to remove selected row in Table with


if (tblDocuments.getValue != null) {
  docs.removeItem(docs.getItem(tblDocuments.getValue).getBean)
  tblDocuments.select(null)
}

It works, but I need to keep selection in Table after deletion, like select next row or previous one if there is none. I assume it involves working with getItemIds(), but it’ll be a boilerplate, perhaps there is a better way.
If you can provide an example (even with getItemIds), it will be much appreciated.

You could do something like:

Object nextId = table.nextItemId(table.getValue());
if (nextId != null)
    table.setValue(nextId);

You should probably do this before calling the removeItem().

Does this answer your question?

Thanks :bashful: