Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Grid Editor: How to receive commit events in non-buffered mode
I have an editable grid and I want to use the non-buffered (Grid#setEditorBuffered(false)) - Mode. As stated in the documentation (https://vaadin.com/docs/-/part/framework/components/components-grid.html#components.grid.editing.unbuffered), changes are beeing committed directly to the container. Which, in my case, is a BeanItemContainer. While the updating-part works fine, I also need to receive any updates being made to an Item. But I do not quite know how to achive that.
The buffered mode can utilize the editor field group's FieldGroup.CommitHandler to hook itself into pre- and postCommits (which works fine). But the non-buffered does not. What is the best aproach here? Why do those two modes do things differendtly in the first place!?
btw I use vaadin 7.6.7. Thank you guys and gals :)
we are also facing similar problem. Transactional container helps you get the new value but not clear on which field or old value of field Refer : https://github.com/elmot/vaadin-transactional-container-addon
Thank you so much for the response. The transactional container addon appears to be a great choice in case you want to commit / rollback several grid rows in one go. You still would need to trigger the commands themself "manually", though. Just as they do in their demo. And that is absolutely fine as "the grid" can not determine when it's appropriate to do the commit, "the user" has to do that job.
What I was actually looking (but not explicitly asking (sorry!)) for is an "implicit" commit. Just as the addon does with it's "implicit transaction start", after the user leaves an editied row. I then could trigger "global validations" (e.g. take into account other data / user input, something only "the Controller" can validate because it exceeds simple field validation), handle a database-update and deal with the fallout. What if an external source needs to "enhance" / check the updated data? But, as I said, I want to to it each and every time the user leaves an edited row, the sole exception might be "leaving via 'ESC''. But this would only be possible if the grid would fire appropriate notifications, which it does not atm?
Setting a text editor fileld for a grid column and adding blur listener is enough to capture new value user has modified in that cell. We are using this to perform similar actions on commit hook for un-buffered grid. Hope it helps.
Blur listener seems like fine solution, but how can you determine which row item initiated that action? I can only see new value, but i dont have any information about previous value or the row.
Is it possible to find out ?