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

Unavailable cells not working properly

Asked by Anonymous
9 months ago.

The unavailable schedules of my resources are dynamic. I’ve already defined them through the “unavailable” property of the resources.

However, there is a case where a resource has the following unavailable schedules:

{start: '2024-02-21T00:00:00.000', end: '2024-02-21T11:00:00.000'}

{start: '2024-02-21T23:00:00.000', end: '2024-02-21T23:59:59.000'}

The first schedule is working fine, the hours are disabled from 00h to 11h.

But for the second, only the first cell of 23h (im using cellDuration: 30) is disabled. The last 30 minutes are not (from 23h30 to 00h).

I’ve already tried to change '2024-02-21T23:59:59.000' to '2024-02-21T24:00:00.000' or '2024-02-22T00:00:00.000' but it’s still not working.

How can i fix this, making both cells disabled from 23h to 00h?

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

If you want to disable Scheduler cells for drag and drop operations, it is necessary to mark them as disabled in the onBeforeCellRender event handler.

The unavailable property of resources is not a standard part of the API. It’s used is some examples as one of the ways to store the availability data with resources.

The logic that applies the disabled status is always implemented in your onBeforeCellRender event handler. So I recommend checking the code that you use there. It is necessary to check for overlaps of the cell (args.cell.start and args.cell.end) and the start and end of the defined range.

You can find an example of the overlap checking (using the DayPilot.Util.overlaps() method) in the JavaScript Scheduler: Displaying Holidays tutorial and the attached project.

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