Hi, I have this code where essentially it will reload the page with the same entity, but after it’s saved in the db
public class SelfBillingTransactionDetailView extends StandardDetailView<TrxHead> {
//
//
public void onSaveBtnClick(final ClickEvent<JmixButton> event) {
TrxHead trx = datamanager.save(getEditedEntity());
viewNavigators.detailView(TrxHead.class)
.editEntity(trx)
.withViewClass(SelfBillingTransactionDetailView.class)
.navigate();
}
}
I understand that when navigating to other page, it will consider as closing the page, so a save confirmation dialog will show. i want it to not show in this particular instance.
I also tried using closeWIthSave() method with then(), but it goes back to the list view page before navigating into the edit page
The saveAction closes the view, return it to the list page, but saveCloseAction returns it to the dashboard/root url (localhost:8080).
I screen recorded my screen but i cant upload it here, so here is the drive link for the video.
Why do you think that details_save closes the view?
You navigate to another view right after executing it, so the navigation closes your original view.
In the video, the clicking the button goes to the listing page then go to the TrxLineDetailView page. The viewNavigators pnly navigate to TrxLineDetailView page directly. When I didn’t put the saveAction.execute() in the code, it asks a save confirmation (which i’m trying to avoid thats why im triggering saveAction.execute() there),clicking Save will save and goes to listing page (not even going to TrxLineDetailView page).
Also, I run this code:
public void onCreateLineBtnClick(final ClickEvent<JmixButton> event) {
saveAction.execute();
}
Make sure your injected saveAction is really of detail_save type, because in standard generated views this action is actually detail_saveClose. You can check it in the debugger by stepping into your saveAction.execute() call - the action class should be DetailSaveAction.
Also, note that you can override the hasUnsavedChanges() method of your detail view to get rid of unsaved changes notifications.
If it doesn’t help, please create a small test project which demonstrates your problem and attach it here.
Thank you for your suggestion.
I managed to workaround this issue using dataContext.save()
But as a note, the saveAction does go to DetailSaveAction class when i run the debugger.