Premium support for our pure JavaScript UI components


Post by denysveovo »

Dear Premium Support,
when I switched on in my project eventDrag with the next config:

eventDrag: {
        showTooltip: false,
        constrainDragToTimeSlot: true,
        constrainDragToTimeline: false
}

it start freezing me some events, make them shorter and set green background (which is default color and was overwrite in my project). It was rare case and difficult to understand what behavior gave such an odd result, but finally I got it:
when you start dragging the event and then decided to return it back (change your mind, selected wrong event, whatever) and the drop "Y" coordinate stay the same as the drag start point has (like you moved your mouse just left or right) then the bug appears.
Sometimes it's a bit difficult to repeat so check the attached video. I used the project from ticket: https://github.com/bryntum/support/issues/6369 and just changed there

eventDrag: false

to config mentioned higher.
Also, I'm not sure if it is related, but i had the same result when I tried to implement logic from this example https://bryntum.com/products/scheduler/examples/drag-outside/ from

eventDrop

listener in

beforeEventDropFinalize

listener. Is it expected and such a logic should be in

eventDrop 

only? Or is it a bug and should I create another one ticket? Or maybe event it is related to current problem?
Wait for your answer.
Thank you in advance!
Denys

Attachments
drag-and-drop.mp4
(21.26 MiB) Downloaded 29 times

Post by marcio »

Hey Denys,

Regarding the difference between the eventDrop and beforeEventDropFinalize, you'll see in the documentation https://bryntum.com/products/scheduler/docs/api/Scheduler/feature/EventDrag#event-beforeEventDropFinalize and https://bryntum.com/products/scheduler/docs/api/Scheduler/feature/EventDrag#event-eventDrop that the parameters are different, so that's why you can just move the logic from one listener to the other.

Best regards,
Márcio


Post by marcio »

Also, I added your configuration, but couldn't reproduce the behavior in the video with the example that is attached in the other issue with your configuration, perhaps you could adapt and share the example that you used with your adaptations here?

Best regards,
Márcio


Post by denysveovo »

about first your message - of course I understand it and I change the logic to have the same result - remove event from one scheduler and add to another, but it looks like that after that listener it tries to finalize the process and apply some changes to object which is not already exist. I think the behavior should be different in the best case it should make the animation to the new place of the item in the new scheduler (as it returns back if i call finalize(false) ), but I understands the it could be complicated despite of the fact that the schedulers are partners, so at least there shouldn't be errors. Or if the behavior is expected you think, the should be note in documentation not to use beforeEventDropFinalize for changing event stores.


Post by denysveovo »

About your last message - here is the full project where I reproduced the bug:

Attachments
drag-and-drop-bug.zip
(206.18 KiB) Downloaded 31 times

Post by marcio »

Hey,

Thanks for the example. I reproduced the behavior you described and created a ticket for it https://github.com/bryntum/support/issues/6389

Best regards,
Márcio


Post by denysveovo »

Thank you very much for your help!


Post by marcio »

About the beforeEventDropFinalize, could you provide the code that you adapted for that function?? Would be easier for us to check with that information.

Best regards,
Márcio


Post by denysveovo »

Yes of course. It is a simple function which remove event from one scheduler and add to another. In prowided project it would look like:

@ViewChild("first") first: SchedulerPro;
@ViewChild("second") second: SchedulerPro;

public theFunction (event: BeforeDropFinilizedEvent) {
        const eventModelId = <number | string>this.getEventModelIdFromBeforeDropFinilizedEvent(event);
        const eventModel= <EventModel>this.first.instance.eventStore.remove(eventModelId )[0];
        const newResourceForSecondSceduler= this.createNewResource();

    eventModel.set("resourceId", newResourceForSecondSceduler);
    eventModel.set("cls", "");
    eventModel.set("customProperty", false);
    this.second.instance.eventStore.add(eventModel);
}

By the first I get an Id of the dropped event and remove this event from first scheduler. Then I updated the event in a way my business logic requires and add the event to the second scheduler.


Post by alex.l »

Hi,

I might be missing something, but I cannot use the code you posted in last message with your application drag-and-drop-bug. How to reproduce the problem you described?
Btw, I highly recommend you to avoid using resourceId notation for assignments in Pro version of the Scheduler and fill in AssignmentStore instead. The thing is that SchedulerPro uses multi-assignment mode by default, but resourceId notation may be used only for single assignment mode, as simple Scheduler uses by default.
Another thing that meta of record might be wrong when you re-use deleted record and add same instance to another or same store. As example, some links to old assignments or dependencies might still exists. We need to run the code and debug it to see what exactly is going on.

So please, adopt your application to use the code you posted in your last message, attach it here, and provide steps to reproduce, expected result and actual result. Here is the guide how to ask for help to get fastest support viewtopic.php?t=772

All the best,
Alex


Post Reply