Removing bean from BeanContainer


I build instance of Table component with BeanContainer. I turn on Immediate property for that table. Also I must produce “Add New” and “Remove” actions to users. AddNew works fine: I make container.addBean(new SomeBean(...)) call and table component immediately show new item.
I have troubles with remove action. I try to remove items like container.removeItem(container.getItem(currentEntryID).getBean()); and it removes bean instance but table doesn’t respond to that change - removed item exists in UI. I can make “removeAllItems” call and fill bean container ones again but I think it’s too brutal.

What I’m doing wrong?


You verified that removed doesn’t exist in db? If no, do you have commit() method after removeItem()?

If you have the both answer true, try add refresh() method to container.

Best regards,

Hi, Paul

I don’t have any DB, all my objects exist only in memory of application. I try to be more specific: “container” from previous message is an instance of BeanContainer class. Table instance use this object to access bean properties.

And actually I just a minute ago found mistake!!!

There is no need to put any item or bean instance in “removeItem” method of BeanContainer! Instead I must put a bean ID value and all works fine!

Sorry for false alarm.