jquery fullcalendarはこれまでかなりうまく動作していましたが、表示されるイベントをフィルタできるようにするためのオプションを追加しました。私が使ったアプローチは、AJAXを使ってカレンダーで使用する新しいデータを取得し、既存のカレンダーを空にして、新しいデータでカレンダーを再構築しようとしています。FullCalendar - jqueryとAJAXでイベントを更新する
現在のところ、ページの読み込み時にカレンダーはイベントを正しく読み込みます。フィルタをクリックするとカレンダーから現在のイベントが空になりますが、新しいイベントはロードされませんAJAX呼び出しで返されたJSONには、正しくフォーマットされたイベントデータが含まれていることがわかります。
ここには間違いがあるかもしれません。または組み込みの方法でこれを行う簡単な方法があります。どんな助けも大変ありがとう!
// Store json encoded data in variable
var data = <?php echo $events_json ?>;
// Pass data to the calendar loader
loadCal(data);
// Filter event handler
$('ul#calendar_filters li a').click(function(){
// Retrieve data - have checked this is correctly formatted
new_data = $.get($(this).attr('href'));
// Empty the calendar of existing data
$('#calendar').empty();
// Reload calendar with new data set
loadCal(new_data);
return false;
});
function loadCal(data)
{
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events: data,
eventRender: function(event, element) {
element.qtip({
content: {
text: formatEvent(event),
title: {
text: event.title,
button: true
}
},
show: {
event: 'click', // Show it on click...
solo: true // ...and hide all other tooltips...
},
hide: false,
style: {
classes: 'ui-tooltip-light ui-tooltip-shadow ui-tooltip-rounded'
}
});
}
});
}