Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to add a new row to the top of a Table?
I have a table displaying items in reverse chronological order, so if a new item comes, it has to be displayed as the first row in the table. is there a way to do this?
The method addItemAfter(Object previousItemId) adds the new after the given item, I'm looking for some thing like addItemBefore(Object nextItemId).
Thanks!
Depends on the container implementation. E.g. IndexedContainer has a method addItemAt(int index), but BeanItemContainer doesn't support it. How about calling container sort after every new item addition.
Hi Johannes, thanks a lot for the help, the IndexedContainer worked for me.
But I have got in to a new issue now The table component does not support rows of different sizes. (same as mentioned in this thread).
Anyways thanks :)
For BeanItemContainer, I discovered that the following works, but it could be just by accident. Perhaps the frame work swallows a npe, and just puts it at the top by default?
mytable.addItemAfter(null, newItem);