Table rollback, discard changes

Hello,
my case: I have editable table in modal window which is connected to BeanItemContainer. I have save and cancel button which do common job so save saves changes to data (xml file) and cancel discards changes which user made and closes the window. I have set up setWriteThrough(false) to table and buttons invoke adequately commit() and discard() method.

problem: cancel button doesn’t work as I expected :frowning: when I change some fields in table and press cancel, window closes and when I open it again table is in the same state (with my modifications).

I was searching for solution but I didn’t find anything suitable to my case, Lazy Load Container is not a good alternative because I don’t read my data in batches - as I mentioned it is a file and it is readed to memory after application start up.

I was thinking about setting new container everytime user opens window with table, so it would contain actual data - but I think this is not very pretty aproach.