jquery 中完整日历的示例

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1538071/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 11:40:29  来源:igfitidea点击:

Sample for Full Calendar in jquery

jqueryasp.net-mvccalendarfullcalendar

提问by Prasad

I am trying to integrate the jquery Full Calendar (http://arshaw.com/fullcalendar/) in my asp.net mvc application.

我正在尝试在我的 asp.net mvc 应用程序中集成 jquery 完整日历 ( http://arshaw.com/fullcalendar/)。

I need to use this full calendar to add/edit/delete/show the events using the sql server database as backend.

我需要使用这个完整的日历来添加/编辑/删除/显示使用 sql server 数据库作为后端的事件。

Do anyone have the sample code to implement the add/edit/delete events with this Full Calendar.?

有没有人有示例代码来实现这个完整日历的添加/编辑/删除事件。?

回答by lomaxx

function createCalendar() {

    var d = new Date();
    var y = d.getFullYear();
    var m = d.getMonth();

    $('#calendar').fullCalendar({
                editable : false,
                events : 'urltoevents'
                aspectRatio : 1.5,
                header : {
                    left : false,
                    center : 'title',
                    right : 'prev,next today'
                },
                eventClick : function(event) {
                    handle the click event.
                }
            });

};

function removeEvent(id){
    $('#calendar').fullCalendar('removeEvents', id);
}

function updateEvent(id, title){
    var event = $('#calendar').fullCalendar('clientEvents', id);
    event.title = title;
    $('#calendar').fullCalendar('updateEvent', event);
}