Hey,
I’m currently in the need for something which is pretty similar to the CrudEditor (best case this component should be useable without the CRUD Grid somehow).
While developing it I came into the need to display the confirm dialog when data changed and the user wants to change the dialog.
I successfully implemented this for the cancel button but sadly for closing it with ESC button this doesnt work:
addDialogCloseActionListener(e -> {
if(this.form.getBinder().hasChanges()) {
ConfirmDialog confirmDialog = new ConfirmDialog();
confirmDialog.setHeader(getTranslation("crud.confirm.cancel.title"));
confirmDialog.setText(getTranslation("crud.confirm.cancel.content"));
confirmDialog.setConfirmText(getTranslation("crud.confirm.cancel.button.confirm"));
confirmDialog.setCancelText(getTranslation("crud.confirm.cancel.button.dismiss"));
confirmDialog.setCancelable(true);
confirmDialog.open();
confirmDialog.addCancelListener(cancelEvent -> confirmDialog.close());
confirmDialog.addConfirmListener(confirmEvent -> {
confirmDialog.close();
close();
});
return;
}
close();
});
binding this code to the cancel button works but not for the CloseActionListener. The CrudEditor has the functionality to show the confirm dialog on esc close.
How I do get this working? Help appreciated.