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

Snap to Grid

Asked by JA
7 years ago.

Is it possible to have a setting for snap to grid to allow different snapping times.

I have a Scheduler application that has days (1440 minutes) as the main timeline. I need to make annual leave bookings of half a day.

I can (and have) changed the minutes to 720 but this shows too many gridlines and looks messy when viewing a month.

I have changed the matrix css style to add :nthchild(odd) and :nthchild(even) which works if you do not have about more than 45 days. After that, when it scrolls, the odds become evens and it looks awful. Also there is a bug with this in that it does not always snap to the half day slot!!!

I have also tried overriding the resize event to force the selection to be half days, but it does not look as good as snapping to half days and can be confusing.

I have even tried having an extra event in the database and using a full height duration bar as a hack and this works but only lets me snap to a day and then select half days in the new dialog box.

I am really liking the scheduler, but at the moment without this, it isn't quite right for my target audience.

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

I have created a simple tutorial that demonstrates how to do this:

http://code.daypilot.org/98349/annual-leave-booking-asp-net-c-vb-sql-server

It is based on the current sandbox version of DayPilot (http://www.daypilot.org/sandbox/) that includes a new implementation of the time line: it allows the time headers to be completely independent from the cells.

The tutorial uses CellDuration="720" and time headers grouped by month (row 1) and day (row 2). This combination displays two cells per day but just one header cell per day.

It also highlights the day start and end in the grid using separators (see http://doc.daypilot.org/scheduler/separators/) with slightly darker color (#cccccc). You can hide the half-day vertical lines by disabling the .scheduler_white_matrix_vertical_line in the theme.

Let me know if there is any problem with this solution.

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