bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
54 stars 6 forks source link

D&D behavior different for events dragged from partnered scheduler #2819

Open jsakalos opened 3 years ago

jsakalos commented 3 years ago

The user updates the record in eventDrop event and the change is reflected when the event is dragged within the scheduler. If dragged to the partnered scheduler, the update is lost since cross-scheduler clones the event:

This only works when dragging within scheduler:

    listeners : {
        eventDrop({context}) {
            const { eventRecord } = context;
            eventRecord.name = 'hello';
        },

This works in all cases:

beforeEventDropFinalize({context}) {
    context.eventRecords[0].name = 'foo';
},

The behavior should be consistent.

Forum

matsbryntse commented 3 years ago

Happens since event is copied over to the new event store in the case of cross-scheduler drop. Workaround:

eventDrop({ context }) {
            console.log('eventDrop');

            const eventRecord = scheduler2.eventStore.getById(context.eventRecord.id);

            eventRecord.name += 'world';
        }
matsbryntse commented 3 years ago

Either remove cloning or replace data in event context after cloning in EventDrag#updateAssignments:


if (eventsToAdd) {
            context.eventRecords = eventsToAdd;
        }