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

Prevent multiple range inside of itself

Asked by Vincent
1 month 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]
1 month ago.

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

Comment posted by Anonymous
1 month 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]
1 month 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;
  },
  // ...
}
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.