我能够通过使用fullcalender jQuery将特定日期的事件保存在数据库中。但是如何在fullcalender jQuery控件的数据库中填充相应日期的已保存事件呢?
发布于 2010-10-22 07:54:04
如果不知道您在服务器上使用的是什么语言,就很难给您一个答案……
我已经在一些.NET MVC解决方案中使用过FullCalendar,并取得了巨大的成功……我以以下格式返回JSON (从我现有的代码中截取):
[{
id = a.AppointmentID,
start = a.Appointment.DateTime,
title = a.Appointment.Total,
allDay = a.Appointment.AllDay,
leave = a.Appointment.Leave,
end = a.Appointment.DateTime.AddHours((double)a.Appointment.Duration),
url = "/Appointments/Edit/" + a.AppointmentID,
}]在客户端,我使用以下代码从MVC Action请求JSON:
function getEvents(start, end, callback) {
var calendar = $(this);
var id = calendar.attr('staffid');
$.ajax({
url: '/Appointments/Events',
dataType: 'json',
data: {
start: Math.round(start.getTime() / 1000),
end: Math.round(end.getTime() / 1000),
staffID: id,
_d: new Date().getTime()
},
success: function (json) {
callback(json);
}
});
}有关事件结构的详细信息,请参阅http://arshaw.com/fullcalendar/docs/event_data/Event_Object/和http://arshaw.com/fullcalendar/docs/event_data/events_json_feed/上的FullCalendar帮助
希望这能有所帮助。
https://stackoverflow.com/questions/3965653
复制相似问题