This is probably really remedial, but I haven’t had to do it yet, and I can’t seem to find the solution.
I’ve got a button that, when clicked, needs to check a few things, and if conditions are good, needs to commit the entity data from a standard editor and close the window like normal. I’ve searched the forum and the documentation, but haven’t been able to figure this thing out.
It’s that simple. OnThisButtonClick, evaluate a case, if cool, commit and close. I don’t know why I haven’t been able to find this.
@Subscribe("finalizeBtn")
public void onFinalizeBtnClick(Button.ClickEvent event) {
if (allReportingYearFieldsEntered()) {
finalizedCheckBox.setValue(true);
//commit and close
} else {
notifications.create()
.withCaption("More Data Required")
.withDescription("Please complete all fields for this reporting year prior to finalizing your entry.")
.withType(Notifications.NotificationType.ERROR)
.show();
}
}
Hi,
Take a look at the base class for all editor screens - StandardEditor.
It contains many methods associated with the editor life cycle.
The method you need is a StandardEditor#commitAndClose()