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

Snap off the grid

Asked by Kuest
26 days ago.

Hi Dan/Daypilot,

Not sure how to continue. I would not like to adjust the timeline (i prefer the vertical segments/lines to be aligned with the cell grids) but adjust only the snap to grid function and also for the event dragging.

E.g. for an event (hotel booking) the snap function snaps to the start date + 12 hours. The event duration (draggable) has to be in steps of 24 hours (I tried the cell duration of 720 and this comes an issue).
The overlap function is a great one, so In this case how to proceed/adjust this?

How can I make this work?

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

The real-time onTimeRangeSelecting/onEventMoving/onEventResizing event handlers let you adjust the start/end of the current drag&drop target according to your needs. These events can be used to snap the events to custom start/end times.

There is a tutorial that shows how to do that:
https://code.daypilot.org/39403/javascript-scheduler-customized-snap-to-grid

You just need to adjust the logic to change the start/end to the nearest 12:00 time.

New Reply
This reply is
Your name (optional):