Hi Dev Team,
Is it possible to drag a task from Gantt and assign the task to a resource in Scheduler(drop). If its possible what should be the approach?
*Here dragging a task is like cloning the task not entirely moving
Support Forum
It's not supported out of the box, but you can try to implement it with the help of https://www.bryntum.com/docs/gantt/#Core/helper/DragHelper. Please check out Scheduler's "Drag from Grid" demo (https://www.bryntum.com/examples/scheduler/dragfromgrid/) and Drag.js file (Scheduler/examples/dragfromgrid/lib/Drag.js).
Pavlo Miklashevych
Sr. Frontend Developer
Hi
I tried to drag the task in gantt. But getting task information as null in the context using onTaskDragStart().
I have given targetSelector as '.b-gantt-task'. How I can get the task information?
import {DateHelper,DragHelper,DomHelper,WidgetHelper } from "@bryntum/gantt";
export default class Drag extends DragHelper {
static get defaultConfig() {
return {
cloneTarget : true,
mode : 'translateXY',
targetSelector : '.b-gantt-task',
dropTargetSelector : '.b-timeline-subgrid'
};
}
construct(config) {
const me = this;
super.construct(config);
me.on({
dragstart : me.onTaskDragStart,
drag : me.onTaskDrag,
drop : me.onTaskDrop,
thisObj : me
});
}
onTaskDragStart({ context }) {
const
me = this,
{ schedule } = me,
proxy = context.element,
task = me.gantt.getRecordFromElement(context.grabbed);
context.task = task;
proxy.classList.add('b-sch-event-wrap');
proxy.classList.add('b-unassigned-class');
proxy.classList.add(`b-${schedule.mode}`);
me.schedule.enableScrollingCloseToEdges(me.schedule.timeAxisSubGrid);
schedule.element.classList.add('b-dragging-event');
}
};
It hard to say without more context. Could you please attach a runnable test case?
You could try to get the record using https://bryntum.com/docs/gantt/#Scheduler/view/mixin/SchedulerDom#function-resolveEventRecord
eventRecord = me.gantt.resolveEventRecord(context.grabbed)
And I would also recommend you to review these examples:
https://bryntum.com/examples/examples-scheduler/drag-between-schedulers/
https://bryntum.com/examples/scheduler-pro/nested-events/
All the best,
Alex
All the best,
Alex