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

Scheduler right click context menu for multiple event selections

Asked by daniels
6 years ago.

Hi,

The event multiselect demo allows multiple selections to be made, but right clicking on an event brings up a context menu that operates only on the one event that's been clicked on. Eg, even though multiple events are selected, right click context menu delete will only delete one event.

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

Is there any way of having the context menu action operate on all selected events? Eg, if 5 events are selected, the context menu delete will delete all 5 events selected.

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

You can get a list of selected events using DayPilot.Scheduler.multiselect.events() method:
https://api.daypilot.org/daypilot-scheduler-multiselect-events/

You can call this method in the onClick event handler of the menu item:

dp.contextMenu = new DayPilot.Menu({items: [
    {text: "Delete Selected Events", onClick: function(args) {
            dp.multiselect.events().forEach(function(e) {
                dp.events.remove(e);
            });
        }
    }
]});

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