Page 1 of 1

[REACT] Manually reassigning a dragged event causes the event to flicker before being dropped

Posted: Thu Mar 30, 2023 7:46 pm
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?


Re: [REACT] Manually reassigning a dragged event causes the event to flicker before being dropped

Posted: Fri Mar 31, 2023 6:09 am
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


Re: [REACT] Manually reassigning a dragged event causes the event to flicker before being dropped

Posted: Fri Mar 31, 2023 3:07 pm
by dphilip

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


Re: [REACT] Manually reassigning a dragged event causes the event to flicker before being dropped

Posted: Fri Mar 31, 2023 3:47 pm
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


Re: [REACT] Manually reassigning a dragged event causes the event to flicker before being dropped

Posted: Fri Mar 31, 2023 4:00 pm
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 303 times

Does that solve your problem?