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

Prevent event drag beyond first / last cell?

Asked by B.
8 years ago.

If I create a longer event (4-5 days) and grab it by the left side, I can drag it beyond the last date on the calendar. I can do the same thing the other way around (drag it before first date). Is there a way to disable this?

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

You can add a custom onEventMoving handler:

dp.onEventMoving = function(args) {

  if (args.end > dp.visibleEnd()) {
      args.left.enabled = true;
      args.left.html = "You can't drag the event out of the visible range";
      args.right.enabled = true;
      args.allowed = false;
  }

  if (args.start < dp.visibleStart()) {
      args.right.enabled = true;
      args.right.html = "You can't drag the event out of the visible range";
      args.left.enabled = true;
      args.allowed = false;
  }
};

See also:
http://api.daypilot.org/daypilot-scheduler-oneventmoving/

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