我想通过fullCalendar在JSON feed中显示事件,并且会在当前时间显示事件,而不是通过Feed提供的时间:
function getAvailableDates() {
$("#availabilitySchedule").fullCalendar({
events: {
url: window.location.href + '/available_dates',
type: 'GET',
dataType: 'JSON',
data: {
startParam: 'availability_start',
endParam: 'availability_end',
allDay: false,
}
},
allDaySlot: false,
slotEventOverlap: false,
editable: false,
droppable: false,
unselectAuto: true,
timezone: 'local',
});
}
以下是我的JSON Feed:
[{"id":20,"professional_id":49,"availability_start":"2015-01-29T14:18:00.000Z","availability_end":"2015-01-29T21:18:00.000Z","recurrances":"single","created_at":"2015-01-28T21:18:38.000Z","updated_at":"2015-01-28T21:18:38.000Z"}]
知道可能导致这种情况发生的原因吗?
答案 0 :(得分:1)
好吧,看起来我能找到答案here。这就是我现在所拥有的,现在似乎对我有用了:
events: function (start, end) {
$.ajax({
url: window.location.href + '/available_dates',
dataType: 'json',
success: function (data) {
var events = [];
$.each(data, function (index) {
events.push({
"start": data[index].availability_start,
"end": data[index].availability_end
});
});
callback(events);
},
error: function () { alert('Oh no!'); },
});
}