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

Prevent multiple range inside of itself

Asked by Vincent
22 days ago.

It seems if I hold control for the multi range, this allows me to select a range within another range. I need to be able to do multi range but disallow conflicts. What is the best way prevent collision in the multi-range select?

Answer posted by Dan Letecky [DayPilot]
21 days ago.

The Scheduler respects the value of allowEventOverlap - if you set it to false, the overlaps will be forbidden.

Comment posted by Anonymous
20 days ago.

Is this the only way? I had to disable the allowEventOverlap setting because it was causing false conflicts when I drag/dropped events(this was happening because I am updating the position of the start/end date on the moving event to snap to a certain time).

Comment posted by Dan Letecky [DayPilot]
17 days ago.

With the latest sandbox build (2025.3.6611), you can use a custom onTimeRangeSelecting handler to implement this rule:

{
  allowMultiRange: true,
  allowEventOverlap: true,
  onTimeRangeSelecting: args => {
      const overlapsExisting = args.multirange.some(item => {
          return DayPilot.Util.overlaps(item.start, item.end, args.start, args.end) &&
              item.resource === args.resource;
      });
      args.allowed = !overlapsExisting;
  },
  // ...
}
New Reply
This reply is
Attachments:
or drop files here
Your name (optional):