Our state of the art Gantt chart


Post by hien.nguyen »

Hi team,

When I click button "Delete" on popup edit task, system have Confirm deletion but when I select item Delete from context menu (right click into task) system not display confirm deletion popup.

Please share me the way to show Confirm deletion popup when delete task from context menu?

Best regards.


Post by tasnim »

Hello hien.nguyen,

To achieve that you could listen to the delete item of the menu by https://bryntum.com/products/gantt/docs/api/Gantt/feature/TaskMenu feature

And Then you could use the https://bryntum.com/products/gantt/docs/api/Core/widget/MessageDialog widget to make a confirm popup

Here is the code

    features : {
        taskMenu : {
            items : {
                deleteTask : {
                    async onItem({ selection, taskRecord }) {
                        const store = this.owner.owner.project.taskStore;
                        const result = await MessageDialog.confirm({
                            title : 'Delete',
                            message : 'Are you sure, you want to delete this task?',
                            okButton : 'Yes',
                            cancelButton : 'No'
                        });
                        if (result === MessageDialog.okButton) {
                            store.remove(selection.includes(taskRecord) ? selection : taskRecord);
                        }
                    }
                }
            }
        }
    },

Attachments
chrome_BcjiBLe2BI.gif
chrome_BcjiBLe2BI.gif (1.62 MiB) Viewed 195 times

Post Reply