DayPilot.Scheduler.onTimeRangeSelecting

Real-time event that is fired whenever the time range selection size changes during drag & drop time range selecting.

Declaration

onTimeRangeSelecting(args)

Parameters

  • args.start - start date/time of the current selection (DayPilot.Date object)
  • args.end - end date/time of the current position (DayPilot.Date object)
  • args.duration - duration of the selection (DayPilot.Duration object)
  • args.resource - id of the resource (row)
  • args.allowed - set to false to forbid this selection
  • args.left.html - HTML of the inline start indicator; default value is set to args.start.toString(calendar.eventMovingStartEndFormat)
  • args.left.enabled - when set to true, the inline start indicator is displayed; default value is set to calendar.eventMovingStartEndEnabled
  • args.right.html - HTML of the inline end indicator; default value is set to args.start.toString(calendar.eventMovingStartEndFormat)
  • args.right.enabled - when set to true, the inline end indicator is displayed; default value is set to calendar.eventMovingStartEndEnabled

Example

External message

dp.onTimeRangeSelecting = function(args) {
  $("#msg").html(args.start + " " + args.end + " " + args.resource);
};

Inline message

dp.onTimeRangeSelecting = function(args) {
    if (args.duration.totalHours() > 4) {
        args.right.enabled = true;
        args.right.html = "You can only book up to 4 hours";
        args.allowed = false;
    }
};