对不起这个最有可能简单的问题。我想JSON
向 fullCalendar 添加一些自定义数据并在我的 dayClick 回调函数中使用它。更具体地说,我想在 dayClick 中访问和更改 customData 上的元素。但是我不知道该怎么做。是否可以不更改 fullcalendar 源代码?
提前非常感谢 Jens
$('#calendar').fullCalendar({
....
firstDay: 1,
customData: { foo: 'bar', more: 'baz' },
dayClick: function(date, allDay, jsEvent, view) {
// Within the callback function, this is set to the <td> of the clicked day.
var t = $(this);
var foo = customData.foo; // does not work
customData.more = 'foo'; // does not work
// Change the day's background color
if (t.hasClass('badge-important') && foo == 'bar') {
t.removeClass('badge-important');
} else {
t.addClass('badge-important');
}
},
});