Our flexible Kanban board for managing tasks with drag drop


Post by yingtao »

from start drag task, to end drag task, I wnt to add classname to task, How can I do ?


Post by marcio »

Hey,

You can achieve that with the following snippet

listeners : {
        taskDragStart : ({ event }) => {
            const customClass = 'classToAdd';
            event.target.parentElement.classList.add(customClass);
        },
        taskDragEnd : () => {
            const customClass = 'classToAdd';
            const [draggableElement] = document.getElementsByClassName(customClass);
            if (draggableElement) {
                draggableElement.classList.remove(customClass);
            }
        }
    }

You'll see that there is a difference because currently, we don't have that event property being passed to the taskDragEnd event, I created a ticket to add it. https://github.com/bryntum/support/issues/4861

https://www.bryntum.com/docs/taskboard/api/TaskBoard/feature/TaskDrag#event-taskDragStart
https://www.bryntum.com/docs/taskboard/api/TaskBoard/feature/TaskDrag#event-taskDragEnd

Best regards,
Márcio


Post by yingtao »

It seem that add classname with drag task, I want add className when begin drag for all tasks.


Post by tasnim »

I want add className when begin drag for all tasks.

This is what the above code does which Marcio gave. You can try it here https://bryntum.com/examples/taskboard/basic/


Post Reply