How can I define event removeTask
thanks
Support Forum
Please check this event https://bryntum.com/docs/taskboard/api/TaskBoard/model/ProjectModel#event-change
It has action
property to determine an action.
All the best,
Alex
I added method to event change as you guide but it is not working
this.taskboard.on('change', this.removeTask.bind(this));
removeTask(editor): boolean {
alert('remove');
return false;
}
another way to add delete event I added but I want to set false if User don't want to remove task, otherwise true.
But event removeTaskElement occur after deleted, So task is removed event I return false;
this.taskboard.on('removeTaskElement', this.removeTask.bind(this));
removeTask(editor): boolean {
alert('remove');
return false;
}
Can you give me another way to attach method to before taskremove. ?
change
event triggered by project
, not by taskboard.
Now I see more clear what you want to achieve.
There is no event that may catch all ways of removing the task and be preventable.
I would suggest you to make own handler for removeTask
menu item and show that dialog before call store.remove
.
Here is a guide how to customize TaskMenu: https://bryntum.com/docs/taskboard/guide/TaskBoard/customization/taskmenu
Original handler calls taskboard.project.taskStore.remove(taskRecord)
inside.
I've added a feature request to add such event to reach it easily, thanks for your question https://github.com/bryntum/support/issues/3813
All the best,
Alex
I declare variable that above
var that = this;
but project is not exists in taskboad
that.taskboard.project.taskStore.remove(taskRecord);
I have this error so I can not set data to project.
So I must set data to project by using
this.taskboard.setConfig(this.taskBoardConfig);
By the way you code give me it works
Thanks a lot