0

我无法将日期附加到 calEvent.Url。同样的事情在 dayClick 中运行良好,但是当我尝试将相同的代码附加到 calEvent.Url 时,我的事件从日历中消失了。我在 Global.asax 中设置了一条路由来处理 url 并将它们引导到正确的操作。这在 dayClick 上工作正常,但在事件点击上却不行。任何帮助是极大的赞赏!

<script type="text/javascript">
$(document).ready(function () {
    $('#calendar').fullCalendar({
        theme: false,
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'agendaDay, agendaWeek, month'

        },

        defaultView: 'month',
        editable: false,
        allDay: true,
        eventClick: function (calEvent, jsEvent, view) {

            window.location.href = 'BrowseCal/' +
                 date.getDate() + '-' +
                    (date.getMonth() + 1) + '-' + // months are zero based
                         date.getFullYear();

            // change the border color just for fun
            $(this).css('border-color', 'red');

        },
        dayClick: function (date, allDay, jsEvent, view) {

            if (allDay) {

                window.location.href = 'BrowseCal/' +
                 date.getDate() + '-' +
                    (date.getMonth() + 1) + '-' + // months are zero based
                         date.getFullYear();


            }

        },

        events: function (start, end, callback, date) {
            // do some asynchronous ajax
            contentType: "application/json; charset=utf-8",
            $.getJSON("/WhatsOn/CalendarData/",

                function (result, date) {
                    if (result != null) {
                        for (i in result) {
                            var calEvent = result[i];

                            calEvent.start = new Date(parseInt(calEvent.start.replace("/Date(", "").replace(")/", ""), 10));
                            calEvent.end = new Date(parseInt(calEvent.end.replace("/Date(", "").replace(")/", ""), 10));

                            **calEvent.Url = 'BrowseCal/' + date.getDate() + '-' + (date.getMonth() + 1) + '-' + date.getFullTear();**


                        }
                    }

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


                });


        }

    });
});
4

1 回答 1

0

好吧,似乎没有在您用*标记代码的地方定义日期。你确定你不想要 start.getDate()、start.getMonth() 等,或者 end.getDate() 等等。

于 2011-09-16T14:58:34.467 回答