dongzhukuai8177 2016-08-25 02:08
浏览 60

禁用fullcalendar插件中的时隙

I was using a fullcalendar plugin for my booking system. How can I disable the day and time in the calendar so that the user cannot book an event in that certain day and time? The code I've tried so far is below, but it currently doesn't work.

disableDate:function(date)
{
   if(options.disableDates) {
      var disabled_dates = options.disableDates
      var string_date = formatDate(date,"MM-dd-yyyy")
      if (disabled_dates.indexOf(string_date) > -1 )
      {
         return true
      }
   }
   return false
}
  • 写回答

1条回答 默认 最新

  • douou2026 2016-08-25 12:41
    关注

    You can use the Background Events to accomplish this. In this codepen example I use some of the code from the FullCalendar Background Events Demo to set background events that will not allow certain events to be placed in that spot.

    // red areas where no events can be dropped
    {
        start: '2016-08-24',
        end: '2016-08-28',
        overlap: false,
        rendering: 'background',
        color: '#ff9f89'
    }
    

    Check out the week view where you can also set constraints where only specified events can be placed in the Background Events.

    {
        title: 'Meeting',
        start: '2016-08-13T11:00:00',
        constraint: 'availableForMeeting', // defined below
        color: '#257e4a'
    },
    {
        id: 'availableForMeeting',
        start: '2016-08-11T10:00:00',
        end: '2016-08-11T16:00:00',
        rendering: 'background'
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像