FullCalendar事件无法呈现/粘贴/出现

时间:2016-02-25 17:30:52

标签: javascript jquery html asp.net-mvc fullcalendar

我正在尝试将事件添加到我的日历中(我还没有将它连接到数据库但尚未保存/检索事件)并添加事件并使它们暂时显示。但是,当我尝试添加一个事件时,没有任何反应,也没有任何内容出现。

出现提示,我可以在其中输入值,但日历不会使用这些事件进行更新。

我的代码如下:

$(document).ready(function()
    {
        /*
            Initialize fullCalendar and store into variable.
            Why in variable?
            Because doing so we can use it inside other function.
            In order to modify its option later.
        */

        $('#calendar').fullCalendar(
        {
            /*
                header option will define our calendar header.
                left define what will be at left position in calendar
                center define what will be at center position in calendar
                right define what will be at right position in calendar
            */
            header:
            {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            /*
                selectable:true will enable user to select datetime slot
                selectHelper will add helpers for selectable.
            */
            selectable: true,
            selectHelper: true,
            /*
            editable: true allow user to edit events.
            */
            editable: true,

            /*
                when user select timeslot this option code will execute.
                It has three arguments. Start,end and allDay.
                Start means starting time of event.
                End means ending time of event.
                allDay means if events is for entire day or not.
            */
            select: function(**start, end**)
            {
                /*
                    after selection user will be promted for enter title for event.
                */
                var type = prompt('BAU/Project/Leave:');
                var title = prompt('Enter hours:');

                var eventData =
                    {
                        **start: start,
                        end: end,**
                        title: type + ": " + title,
                        allDay: true
                    };
                /*
                    if title is enterd calendar will add title and event into fullCalendar.
                */
                if (title)
                {
                    $('#calendar').fullCalendar('renderEvent', eventData, true); // make the event "stick"
                }

                $('#calendar').fullCalendar('unselect');
            }
        });

    });

感谢您的帮助。

修改

我的事件现在出现了,因为我已经包含了开始和结束(因为这些是必需的)但是我得到以下浏览器错误:

Use of getPreventDefault() is deprecated.  Use defaultPrevented instead. browserLink:37:40278
no element found

0 个答案:

没有答案