我刚刚在 FullCalendar工作.在 this thread之后,我可以从我页面上的日期选择器中选择特定日期. 我在周视图中显示FullCalendar.我的问题是,在周视图中,我无法在我去过的日期应用fc-state-highlig
我在周视图中显示FullCalendar.我的问题是,在周视图中,我无法在我去过的日期应用fc-state-highlight类.即使本周有我所需的日期,也不会突出显示.
但是,我可以通过使用从当前日期删除相同的类
$('.fc-today').removeClass('fc-state-highlight');
我需要将上面的类添加到我的最新版本中.
任何帮助将不胜感激.
编辑:我自己发布了解决方案.
好的伙计们,我为我的问题制定了一个解决方案.在FullCalendar网站上的this documentation之后,我使用回调方法dayRender()来解决我的问题.
上述方法有两个参数 – 日期和单元格.第一个存储在basicWeek视图中的所有日期.所以,鉴于我所需的日期存储在变量reqDate中,我做了类似这样的事情:
$('#my-div').fullCalendar({
year: reqDate.getFullYear(),
month: reqDate.getMonth(),
date: reqDate.getDate(),
dayRender: function(daysOfWeek, cell)
{
if(reqDate.getDate()==daysOfWeek.getDate())
{
$(cell).addClass('fc-state-highlight');
}
else
{
$(cell).removeClass('fc-state-highlight');
}
}
});
而已 :)
