Hi all!
I have a couple questions regarding doing a confirmation before deleting a task. I am currently partially achieving this via:
new Gantt({
...
listeners: {
beforeTaskDelete() {
return window.confirm("Are you sure you want to delete this task?");
},
},
})
However, I'd prefer use the MessageDialog.confirm
over window.confirm
. The issue with this is that MessageDialog.confirm
is not a blocking action so the action to delete the task is executed at the same time as the MessageDialog.confirm
is rendered. Is there a built in confirmation dialog that is a blocking action, or any other suggestions on how I can achieve preventing deletion based on the action return from MessageDialog.confirm?
Additionally, is there a way to conditionally prevent the Delete action via the TaskContextMenu? Should that delete action also trigger beforeTaskDelete
(doesn't appear to be at the moment)?
BTW, MessageDialog.confirm (gantt-2.1.4) has it's return type defined as void
, where I believe it should be a Promise<boolean>
:
export class MessageDialog extends Popup {
constructor(config?: Partial<MessageDialogConfig>);
static confirm(options: object): void;
}