I hope anyone had come across the same issues as I have. In my example project, I have a Manifest entity, with a composite relationship to a Statusupdate. In the manifest-edit-screen (Which will be a mostly non editable view-screen), I have 5 buttons for giving in a particular statusupdate. Further business logic should force the order of which updates can be given.
When pressing the first button, a statusupdate editor will open, with a pre filled out Statusmessage (shows as non editable, but it will be hidden). After entering the date and committing, a statusupdate entityListener transfers the statusmessage from the statusupdate, to the manifest Batchstatus.
After commiting the statusupdate, want two things to happen, which I cant get to work.
1: I want to refresh the datasource statusupdatesDs when you return back to the manifest edit/view. I’ve came across the statusupdatesD.refresh(), but I cant get that to work ? Maybe because after entering a statusupdate entity, it returns to a parent entity editor/view instead of the statusupdate browser ?
2: After entering a particular statusupdate, when going back to the manifest edit/view, I want the button to be disabled, so the same status cant be inserted twice. Now I have to close the Manifest edit/view, and also the Browser itself, before the page gets reloaded, and the disabled button shows properly. I’ve read about the setAfterCommitHandler, but I can’t get it to work either.
I also came across problem with the 3rd button, which aditionally requires an update to two manifest attributes (The manifest itself is non editable, so this is the only place where you can enter this data). After committing the 3rd statusupdate and attributes, and closing the manifest edit/view, I get the error that the entity was modified in another transaction, which makes sense, since the Manifest got an update by the statusupdate entityListener.
Now I can make an exception in the Listener for this particular status, but since I’m updating datasources and UI elements, perhaps there is also a way to update the manifest entity itself, or even reload the entire open tab ?
Any suggestions would be greatly appreciated! I hope the project makes sense.