Our flexible Kanban board for managing tasks with drag drop


Post by tmcuong »

How can I define event removeTask
thanks


Post by alex.l »

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


Post by tmcuong »

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. ?


Post by alex.l »

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


Post by tmcuong »

I do as your guide but property project can not find in taskboard
you can see my picture

taskboard2.png
taskboard2.png (114.93 KiB) Viewed 1149 times

Post by alex.l »

Check if that scope has any taskboard? Sounds like there is no such object. Try to fix the scope or use source that passed into the handler:

onItem({ taskRecord, source }) {
    source.project.taskStore.remove(taskRecord);
}

All the best,
Alex


Post by tmcuong »

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


Post Reply