我正在使用FullCalender 3.2。問題是如果我從日曆獲取當前事件並清除,然後將新的添加到數組中。當我打電話如何將新事件加載到FullCalender
$('#calendar').fullCalendar('updateEvents',eventsList);
它不工作,但會拋出錯誤
Uncaught TypeError: Cannot read property 'clone' of undefined
at Y (fullcalendar.min.js:6)
at Bt.x [as updateEvents] (fullcalendar.min.js:6)
at HTMLDivElement.<anonymous> (fullcalendar.min.js:6)
這是按鈕單擊處理
var items = $('#calendar').fullCalendar('clientEvents');
items.splice(0, items.length);
items.push({
title: 'All Day Event',
start: '2017-02-01'
});
items.push({
title: 'Long Event',
start: '2017-02-07',
end: '2017-02-10'
});
$('#calendar').fullCalendar('updateEvents',items);
我曾嘗試使用jQuery的版本2.2.4中的代碼和3.1.1但沒有運氣
<link rel="stylesheet" href="resources/css/default.css">
<link rel='stylesheet' href='resources/css/fullcalendar.css' />
<script src='resources/js/jquery-3.1.1.min.js'></script>
<script src='resources/js/moment-with-locales.min.js'></script>
<script src='resources/js/fullcalendar.js'></script>
爲什麼需要拼接項目? –
我刪除舊的事件 – IsaacK
即使我刪除它,我仍然收到錯誤 – IsaacK