我已经将FullCalendar
版本从v.2.3.1更新到2.4.0,然后一切正常,但现在在week view
和agenda view
中我无法添加事件。事情很奇怪,因为在month view
中我看到了我的约会和其他活动。我使用此代码添加事件:
$.each(response, function(index, rsp)
{
$.each(rsp.appointments, function(index, appointment)
{
var check = GeneralFunctions.checkOperatorExistence(myMap, appointment['provider']['first_name']);
if(check.length > 0)
{
var operatore_info = check.split(",");
var column_operator = Number(operatore_info[1]);
var event =
{
'id': appointment['id'],
'title': appointment['service']['name'] + ' - '
+ appointment['customer']['first_name'] + ' '
+ appointment['customer']['last_name'],
'start': appointment['start_datetime'],
'end': appointment['end_datetime'],
'allDay': false,
'color': '#' + appointment['res_id']['hex_color'],
'data': appointment,
'column': column_operator
};
calendarEvents.push(event);
}
})
});
$calendar.fullCalendar('removeEvents');
$calendar.fullCalendar('addEventSource', calendarEvents);
我的代码执行ajax请求,并为系统中保存的每个提供者插入预约。我的代码中有问题,可能是因为版本更改了?我收到系统中的任何错误。
jsfiddle
更新
如果我点击议程视图或周视图的特定日期,我会收到以下错误:
未捕获的类型错误:无法读取未定义的属性"top"
未捕获的类型错误:无法读取null的属性"length"
fullcalendar.js:2026未捕获类型错误:无法读取null的属性"length"
导入库
<link rel="stylesheet" type="text/css"
href="<?php echo $base_url; ?>assets/css/libs/jquery/fullcalendar.css" />
<script type="text/javascript"
src="<?php echo $base_url; ?>assets/js/libs/jquery/jquery.min.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>assets/js/libs/jquery/moment.min.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>assets/js/libs/jquery/fullcalendar.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>UI/multicolumn/fullcalendar-columns.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>assets/js/libs/jquery/fullcalendar-it.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>assets/js/libs/jquery/jquery-ui.min.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>assets/js/libs/jquery/jquery.qtip.min.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>assets/js/libs/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>assets/js/libs/jquery/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>assets/js/backend_calendar.js"></script>
<link rel="stylesheet" type="text/css"
href="<?php echo $base_url; ?>assets/css/custom/custom.css"</script>
可以帮忙吗?
INIT日历设置
$('#calendar').fullCalendar({
'defaultView': 'multiColAgendaDay',
'height': BackendCalendar.getCalendarHeight(),
'editable': true,
'firstDay': 1, //Lunedì
'slotMinutes': 60,
'slotDuration': '00:30:00',
'slotLabelFormat': 'h(:mm)a',
'timeFormat': 'H(:mm)',
'allDayText': EALang['all_day'],
'columnFormat':
{
'month': 'ddd',
'week': 'ddd D',
'day': 'dddd'
},
'titleFormat':
{
'month': 'MMMM YYYY',
'week': 'MMM D YYYY',
'day': 'MMMM D YYYY'
},
'header':
{
'left': 'prev,next today',
'center': 'title',
'right': 'multiColAgendaDay,multiColAgendaWeek,month'
},
'views':
{
'multiColAgendaDay':
{
'type': 'multiColAgenda',
'duration': { days: 1},
'columns': updated
},
'multiColAgendaWeek':
{
'type': 'multiColAgenda',
'duration': { weeks: 1 },
'columns': updated
}
},
我正在为多列使用外部资源,如下所示:https://github.com/mherrmann/fullcalendar-columns
它适用于fullcalendar 2.3.1(您的小提琴使用2.4.0)
http://jsfiddle.net/jkmda709/34/
/*fullcalendar-columns
A FullCalendar extension that adds support for multiple columns (/resources) per day. Tested with FullCalendar v2.3.1, but likely to be compatible with other versions.*/