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

Load blocked cells via ajax?

Asked by Seb
2 years ago.

Is there any way to load blocked cells via ajax after the scheduler has been rendered?

Something similar to resources:
$.get('__URL__', function(data) { dp.resources = data; });

I have to set "blocked period" for specified resource having date start and date end.

Is this possible, or all I have is the onBeforeCellRender event?

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

You can store your period data in resources[] or in a global array and use onBeforeCellRender to check overlaps with the current cell.

There is an Angular tutorial that shows how to do that - it's written in TypeScript but you should get the idea:

https://code.daypilot.org/38541/angular-scheduler-highlighting-holidays

Comment posted by Seb
2 years ago.

Thanks much, but this still uses onBeforeCellRender event - so I have to have period data prior to loading the scheduler. Is there any way to load the scheduler and after that load a period data and mark cells as blocked?

Comment posted by Dan Letecky [DayPilot]
2 years ago.

Changing the cell state requires a refresh of the Scheduler. This is usually very fast operation since it only renders the current viewport - but it's still required.

You can load the date ranges using a separate ajax call and refresh the Scheduler as soon as it is available.

Comment posted by Seb
2 years ago.

Perfect, thanks! :)

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