Disable a specific cell in fullcalendar

I use the full calendar on my portal, and I need to disable a certain cell so that it is no longer active, and the user cannot create an event in this cell.

In addition, I want to paint the disabled slot with a unique color.

+3
source share
1 answer

I know how you can get a cell by date and change its color.

You should see this: https://github.com/arshaw/fullcalendar/pull/26

All you have to do is find the plugin for this line:

cell.find('div.fc-day-number').text(date.getDate()); 

And then you should insert the line below:

 cell.attr('data-date', $.fullCalendar.formatDate(date, "yyyyMMdd")); 

After that, you can get the cell by date using something similar to this:

 $(".fc-widget-content[data-date='20120105']").addClass("disabled-slot"); 

And put the desired color in the cell.

To disable the cell, perhaps you could do something like this (not tested):

 $(".fc-widget-content[data-date='20120105']").draggable({ disabled: true }); 
0
source

Source: https://habr.com/ru/post/1388313/


All Articles