Premium support for our pure JavaScript UI components


Post by dphilip »

I have added code for manually reassigning events to a different start date when I drag/drop an event.

function reassign(event) {
  event.setStartDate(new Date("29 September 2022 11:00"));
}

When I manually reassign the dragged events, using setStartDate or scheduleEvent , there is a slight dance that the event does on screen before it is dropped at the manually set dates.

Bryntum.mp4
(179.43 KiB) Downloaded 21 times

I have tried placing this reassign function at different locations in the code, like https://bryntum.com/products/schedulerpro/docs/api/Scheduler/feature/EventDrag#event-eventDrop , https://bryntum.com/products/schedulerpro/docs/api/Scheduler/feature/EventDrag#event-afterEventDrop,
I also tried placing the reassign code inside the onUpdate listener for eventStore, yet the problem persists.

Can you please suggest me the ideal place to place the reassign code, or if there is a better way to animate the event in this case?


Post by tasnim »

Hi,

It seems like you want to prevent drop.
You could use this https://bryntum.com/products/scheduler/docs/api/Scheduler/feature/EventDrag#event-beforeEventDropFinalize event

    listeners        : {
        beforeEventDropFinalize({ context }) {
            context.valid = false;
        }
    }

You could add your own condition to this

Attachments
chrome_hO4EunvPOz.gif
chrome_hO4EunvPOz.gif (685.6 KiB) Viewed 192 times

Post by dphilip »

I am not trying to prevent drop, I am trying to reschedule the events.


Post by mats »

It's not supported to change the "final destination" during drag-drop, but it seems like this is a reasonable request. I've opened a feature request, which you can track here: https://github.com/bryntum/support/issues/6508


Post by tasnim »

What if you use this code snippet

    listeners : {
        beforeEventDropFinalize({ context }) {
            context.valid = false;
            context.eventRecord.startDate = new Date(2017, 0, 1, 6);
        }
    }
chrome_8pzr4I0tNf.gif
chrome_8pzr4I0tNf.gif (998.64 KiB) Viewed 151 times

Does that solve your problem?


Post Reply