2010-10-19 60 views

回答

0

不知道你正在使用它使得它有点难以给你一个答案在服务器上用什么语言......

我用FullCalendar在几个.NET MVC解决方案取得了巨大成功

...我在下面的格式返回回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行动要求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); 
    } 
}); 
} 

有关事件结构的更多信息,请参见FullCalendar帮助http://arshaw.com/fullcalendar/docs/event_data/Event_Object/http://arshaw.com/fullcalendar/docs/event_data/events_json_feed/

希望这会有所帮助。

+0

哦,我很抱歉,我没有指定我的应用程序描述。反正我正在使用asp.net mvc 2与c#语言。我试试这个代码 – 2010-10-22 06:28:01

+0

我重新打开这个问题,因为它不适用于我。你有任何解决方案 – 2010-12-07 07:13:49

+0

我无法得到我必须在哪里格式此JSON:[{ ID = a.AppointmentID, 开始= a.Appointment.DateTime, 标题= a.Appointment.Total, 阿迪= a.Appointment.AllDay, 休假= a.Appointment.Leave, end = a.Appointment.DateTime.AddHours((double)a.Appointment.Duration), url =“/ Appointments/Edit /”+ a.AppointmentID, }] 你能给我一些关于这个话题的线索吗 – 2010-12-07 07:14:56