search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Click on a eventLink and make some

Asked by Vane
4 years ago.

Dear Dan,

is onClick event available on eventLink? How can I invoke onClick function when I click on eventLink? I need to do following scenario:
1. click on the link/arrow (see the attached print-screen)
2. put all the linked events in multiselect list
3. drag horizontaly
4. drop the linked events
5. update the new datetimes of each event.
6. clear the multiselect list

Is this possible? is there any other better solution instead of using multiselect?

By the way you did great job on the linkBubble and all the other improvements on the Scheduler control in the last few months.

best regards,
Vane

Answer posted by Dan Letecky [DayPilot]
4 years ago.

Hi Vane,

The latest sandbox build (2019.4.4122) now supports onLinkClick and onLinkClicked events.

https://javascript.daypilot.org/sandbox/

It will let you implement this logic but it will also require some manual work (finding all linked events if there are more than two). Also, it will not be able to start dragging immediately - the event click will let you select the events in the onLinkClick event handler and then you can start dragging.

Please let me know if it doesn't work as expected.

There is also a feature called "joint events" (not much documented) which will let you add events to a group that will be always moved/resized together. It's a kind of "auto multi-selection":

https://javascript.daypilot.org/demo/scheduler/eventsjoint.html

So that might be another option.

Comment posted by Vane
4 years ago.

Dear Dan,

Thank you very much for your support.

We implemented the scenario using the ctrl button from keyboard and a mouse click to get moving all linked events combined with jointEventsMove property.

This is the workflow:
1. The default setting for jointEventsMove = false
2. The jointEventsMove is enabled on mousedown event which is registered in onAfterEvetnRender

        dp.onAfterEventRender = function (args) {
            args.div.addEventListener("mousedown", function (ev) {
                if (ev.ctrlKey) {
                    args.e.calendar.jointEventsMove = true;
                }
            }, false);            
        };

3. Then we handle appropriate moving of elements (single or all linked) based on the jointEventsMove flag

       dp.onEventMoved = function (args) {
            if (!args.e.calendar.jointEventsMove) {
                movedSingleBox(args, options);
            } else {
                movedAllBoxes(args, options);
            }

            //reset the joint move
            args.e.calendar.jointEventsMove = false;
        };

We’ll try to implement the same with the onLinkClick and onLinkClicked events.

Thanks again and best regards,
Vane

Comment posted by Dan Letecky [DayPilot]
4 years ago.

Thanks for posting your solution, Vane!

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.