简体   繁体   English

FullCalendar不添加任何事件(周视图,议程视图)

[英]FullCalendar doesn't add any event (week view, agenda view)

I've update FullCalendar version from v. 2.3.1 to 2.4.0, before all working well, but now In week view and agenda view I can't add the event. 我已经将FullCalendar版本从2.3.1版更新到了2.4.0,然后一切正常,但是现在在week viewagenda view我无法添加活动。 The thing is strange 'cause in the month view I see my appointments and other event. 事情很奇怪,因为在month view我看到了约会和其他事件。 I'm using this code for add the event: 我正在使用以下代码添加事件:

$.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);

my code perform an ajax request and insert the appointment for each provider saved in my system. 我的代码执行ajax请求,并为系统中保存的每个提供程序插入约会。 There's something wrong in my code probably for the version changed? 我的代码有问题,可能是因为版本已更改? I get any error in the system. 我在系统中遇到任何错误。

jsfiddle 的jsfiddle

UPDATE UPDATE

If I click on a specific day of Agenda view or week view I get this error: 如果单击“议程”视图或“星期”视图的特定日期,则会出现此错误:

Uncaught TypeError: Cannot read property 'top' of undefined 未捕获的TypeError:无法读取未定义的属性“ top”
Uncaught TypeError: Cannot read property 'length' of null 未捕获的TypeError:无法读取null的属性“长度”
fullcalendar.js:2026 Uncaught TypeError: Cannot read property 'length' of null fullcalendar.js:2026未捕获的TypeError:无法读取null的属性“长度”

Import library 导入库

 <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>

May be help? 可以帮忙吗?

INIT calendar settings 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
            }
        },

I'm using an external resource for multicolumn like the following: https://github.com/mherrmann/fullcalendar-columns 我正在将外部资源用于多列,如下所示: https : //github.com/mherrmann/fullcalendar-columns

It works with fullcalendar 2.3.1 (Your fiddle is using 2.4.0) 它适用于全日历2.3.1(您的小提琴正在使用2.4.0)

http://jsfiddle.net/jkmda709/34/ 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.*/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM