这是在全日历中显示事件。
但来到周查看事件 r 未在事件时间显示。
这里的测试活动时间是上午 10:00 到下午 12:00。但该事件显示在顶层。
function DisplayCalendar() {
$.ajax({
type: "POST",
contentType: "application/json",
data: "{}",
url: "Events.aspx/GetEvents",
dataType: "json",
success: function(data) {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('div[id*=calendar]').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
select: selectDate,
eventClick: updateEvent,
editable: true,
droppable: false,
draggable: false,
disableDragging: true,
selectable: true,
selectHelper: true,
eventTextColor: 'Yellow',
eventBackgroundColor: 'purple',
eventRender: function(event, element) {
var view = $('#calendar').fullCalendar('getView');
if (view.name == 'agendaWeek') {
//alert(view.visStart);
}
//return false;
},
events: $.map(data.d, function(item, i) {
var sdate = item.StartDate;
var sdatesplit = sdate.split("/");
var sm = sdatesplit[0];
var sd = sdatesplit[1];
var sy = sdatesplit[2];
var syearsplit = sy.split(" ");
var edate = item.EndDate;
var edatesplit = edate.split("/");
var em = edatesplit[0];
var ed = edatesplit[1];
var ey = edatesplit[2];
var eyearsplit = ey.split(" ");
var event = new Object();
event.id = item.EventID;
event.start = new Date(syearsplit[0], sm, sd, 16, 0);
event.end = new Date(eyearsplit[0], em, ed, 18, 0);
event.title = item.EventName;
event.allDay = true;
return event;
//event.id= item.EventID;
//event.title= item.EventName;
//event.start= new Date(y, m, d, 16, 0);
//event.end= new Date(y, m, d, 16, 30);
//event.allDay= true;
//return event;
})
});
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
debugger;
}
});