Premium support for our pure JavaScript UI components


Post by anacoda »

Hi,

When an event is dragged and dropped anywhere, I'd like to set it's "saved" attribute (initially true) to false.

This works when dragging within one scheduler, however I can't seem to change anything on drop to a second scheduler. I've tried this under listeners:

eventDrop({eventRecords} : any) {
            eventRecords.forEach((eventRecord : any) => {
                eventRecord.data = {...eventRecord.data,
                    saved: false,
                    eventColor: "purple"
                }
            })
 },

As well as this:

beforeEventDropFinalize({ context } : any) {
    const record = context.eventRecords[0]
    record.data = {...record.data, saved: false}
}

Both of these work when dragging within one scheduler, however I am unable to get the change to happen when dragging from one scheduler to another (it seems that the event is removed on the first scheduler, and added to the second scheduler which may be why I can't edit it).

How can I create the desired functionality? Thank you!


Post by marcio »

Hey Ana,

Could you please share a sample project about how you set up the two schedulers?? Perhaps adding the listeners in the second one (the one that you drop the event) would work for you??

Best regards,
Márcio


Post by anacoda »

You can reproduce the problem I'm having at this example: https://bryntum.com/examples/examples-scheduler/drag-between-schedulers/

By pasting this code into the scheduler2 initialization

listeners : {
        eventDrop(event)
        {            
event.eventRecords[0].set({eventColor: "purple"}) } },

When dragging within scheduler2, the events will change color, however when dragging from scheduler1 to scheduler2 they will not.


Post by tasnim »

You need to set this event to both schedulers, then it'll work for both.


Post by anacoda »

Setting the event for both schedulers does not fix the problem. I pasted the listener code into each of the two schedulers in the example, and still only dragging and dropping within the same scheduler will change it to purple. Dragging from scheduler 1 to scheduler 2, or vice versa does not change the color of the event.


Post by tasnim »

Oh. Sorry, I forgot to say Use eventDrag instead of eventDrop


Post by marcio »

Hey Ana,

I reproduced the behavior you described, it's a bug. I created a ticket to fix it https://github.com/bryntum/support/issues/5001

Best regards,
Márcio


Post by anacoda »

Thank you, for now eventDrag seems to work but is not optimal as it updates continuously while the event is dragging.


Post by marcio »

Hey Ana,

Glad that worked, perhaps https://www.bryntum.com/docs/scheduler-pro/api/Scheduler/feature/EventDrag#event-eventDragStart would work better for your case?

Best regards,
Márcio


Post by tim.lopez »

Hey all,

Any update on the fix for this?

Cheers,
Tim.


Post Reply