addItemAfter() in an IndexedContainer

I am using an IndexedContainer in a FilteredTable, which is an add-on, but I think the behavior I’m looking for is standard Vaadin. I’m trying to using addItemAfter(). In the FilteredTable I prompt the user to select a row. I use this row to duplicate another row. I want this row to appear just below the selected row so I use:

final Item item = ( (IndexedContainer) getContainerDataSource() ).addItemAfter( selectItemId, newItemId );

Is this all one has to do to insert after an item? There is no “setItem()” or anything. Well, I don’t see a new item inserted in the container, although the database shows that the row hit the DB. Any ideas on how to get the inserted item to show in the grid?

I created a test project to see how this worked, and it ran fine. It may have been that with my FilterTable I had a filter automatically set for “enabled” lines, but the inserted line was “disabled” by default.

Note also that containers may vary in how they treat new items when a filter is active.

If I remember correctly, the IndexedContainer (via AbstractInMemoryContainer.internalAddItem…()) should trigger either partial or complete re-filtering when an item is added, but e.g. some database containers might not do so.