微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

jquery完整日历不显示事件

我使用asp.net mvc列出jquery完整日历中的事件.下面是我用来通过mvc中的json列出事件的脚本.
$('#calendar').fullCalendar({
        theme: true,editable: true,disableDragging: true,disableResizing: true,header: {
            left: 'prev,next today',center: 'title',right: 'month,basicWeek,basicDay'
        },events: function(start,end,callback) {
        // do some asynchronous ajax
        $.getJSON("/User/GetEvents/",{
                    start: dateFormat(start.getTime()),end: dateFormat(end.getTime())
            },function(result) {
                    // then,pass the CalEvent array to the callback
                    callback(result);
            })
        },eventClick : function(event) {
            editEventShow(event);
        },dayClick : function(dayDate){
            addEventShow(dayDate,this);
        }
    });

但上面的脚本没有在日历中显示任何事件.我在上面的脚本中做错了什么?

解决方法

当我从json的事件中解析日期时,它已经解决了:
events: function(start,callback) {
            // do some asynchronous ajax
            contentType:"application/json; charset=utf-8",$.getJSON("/User/GetEvents/",{
                            start: dateFormat(start.getTime()),end: dateFormat(end.getTime())
                    },function(result) {
                            if(result != null)
                            {
                                for (i in result) {
                                    var calEvent = result[i];
                                    calEvent.date = new Date(parseInt(calEvent.date.replace("/Date(","").replace(")/",""),10));
                                    calEvent.start = new Date(parseInt(calEvent.start.replace("/Date(",10));
                                    calEvent.end = new Date(parseInt(calEvent.end.replace("/Date(",10));
                                }
                            }

                            var calevents = result;
                            // then,pass the CalEvent array to the callback
                            callback(calevents);

                    });

        },

原文地址:https://www.jb51.cc/jquery/180849.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐