以下のコードを使用して、jQueryFullCalendarを初期化します。
ただし、すべての月にイベントがあるわけではありません。カレンダーの最初の月のビューを、イベントのある最初の月にします。
例として。現在は6月ですが、カレンダーには8月までイベントがないため、カレンダーの初期表示を6月ではなく8月にデフォルト設定したいと思います。
同様に、6月にイベントがある場合は、デフォルトで6月にします。
$('#fullCalendar').fullCalendar({
selectable: true,
selectHelper: true,
header: {
left: 'prev',
center: 'title',
right: 'next'
},
events: function(start, end, callback) {
$.getJSON(jSONCalendarURL, {
token:jSONAPItoken,
productID: $('#fullCalendar').attr("data-id"),
startDate: $.fullCalendar.formatDate(start, 'yyyy-MM-dd'),
endDate: $.fullCalendar.formatDate(end, 'yyyy-MM-dd')
}, function(data){
var calevents = [];
$.each(data.response, function(index,item){
calDate = index;
child = item.Variations;
if (child.length > 0 ){
if (!$.isEmptyObject(child)){
calPrice = child[0].Price;
calID = child[0].ID;
calAvailable = child[0].Available;
calevents.push({
'id': calID,
'title': buildEventTitle(calAvailable,calDate.substring(calDate.length,calDate.length-2),child[0].Price, calID, child[0].RRP),
'start': $.fullCalendar.parseDate(calDate),
'end': $.fullCalendar.parseDate(calDate),
'allDay': true
});
}
}
});
callback(calevents);
highlightExisting();
}
);
},
eventRender: function (event, element, view) {
if (event.start.getMonth() != view.start.getMonth())
return false;
},
weekMode:'liquid'
});
私がやろうとしていることは達成可能ですか?