在完整日历中设置自定义hiddenDays
我们可以通过设置hiddenDays属性隐藏来自fullcalendar的特定日期。
我需要隐藏一个月的其他星期六。
有可能吗?
您可以使用dayRender
回调函数:
此回调允许您修改属于月份,basicWeek和basicDay视图的日期单元格。 查看可用视图。
date是给定日期的本机Date对象。
检查显示的是否是一个奇怪的星期六; 这样做你可以得到日期的周数,并检查它是否奇怪。
码:
Date.prototype.getWeekOfMonth = function(exact) { var month = this.getMonth() , year = this.getFullYear() , firstWeekday = new Date(year, month, 1).getDay() , lastDateOfMonth = new Date(year, month + 1, 0).getDate() , offsetDate = this.getDate() + firstWeekday - 1 , index = 1 // start index at 0 or 1, your choice , weeksInMonth = index + Math.ceil((lastDateOfMonth + firstWeekday - 7) / 7) , week = index + Math.floor(offsetDate / 7) ; if (exact || week < 2 + index) return week; return week === weeksInMonth ? index + 5 : week; }; function isOdd(num) { return num % 2;} $('#mycalendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, editable: true, events: [{ title: 'event1', start: '2014-01-07' }, { title: 'event2', start: '2014-01-10', end: '2013-05-15' }, { title: 'event3', start: '2014-01-13 12:30:00', allDay: false // will make the time show }], dayRender: function (date, cell) { if (date.getDay() == 6 && isOdd(date.getWeekOfMonth())) { $(cell).addClass('fc-disabled'); } } });
演示: http : //jsfiddle.net/IrvinDominin/cjTF9/
- 为什么Uncaught TypeError:$(…)。fulllCalendar不是函数?
- fullCalendar 1.5.3创建了多个事件,无法删除未选中的事件
- 如何从FullCalendar中删除此事件?
- 从日历中删除所选事件
- Fullcalendar:draggable对象拒绝fullcalendar为droppable,即使fullcalendar接受drop
- 使用复选框过滤FullCalendar事件(使用javascript进行客户端)
- 如果可编辑为false,则fullCalendar eventClick处理程序不起作用
- 是否有人为jquery完整日历构建了定期事件UI?
- 无法使jquery fullcalendar事件正确地着色