khi*_*zar 9 javascript jquery callback fullcalendar
在Adam Shaw的jquery完整日历中是否有回调,在日历完全呈现后调用?我想在该回调中调用clientEvents函数以获取客户端上的所有事件.我尝试在viewDisplay中执行此操作,但在呈现事件之前调用它并且clientEvents返回0事件.
Chr*_*ris 22
我知道这篇文章现在已经很老了,但是如果它有任何帮助,你不需要按照Cheery的建议修改原始来源(尽管他/她的答案也可以正常工作).
您也可以使用已经存在的回调'loading':
$('#calendar').fullCalendar({
loading: function(bool) {
if (bool){
alert('I am populating the calendar with events');
}
else{
alert('W00t, I have finished!');
// bind to all your events here
}
}
);
Run Code Online (Sandbox Code Playgroud)
实际上你可以自己添加它.更新功能render在fullcalendar.js这样的
function render(inc) {
if (!content) {
initialRender();
trigger('complete', null, true);
}else{
calcSize();
markSizesDirty();
markEventsDirty();
renderView(inc);
trigger('complete', null, true);
}
}
Run Code Online (Sandbox Code Playgroud)
并添加到初始调用回调函数:
$('#calendar').fullCalendar({
editable: true,
complete: function() {alert('complete');},
Run Code Online (Sandbox Code Playgroud)
或者,如您所愿,您可以访问所有活动
complete: function() {
var events = $(this).fullCalendar('clientEvents');
for(var i in events)
{
alert(events[i].title);
}
},
Run Code Online (Sandbox Code Playgroud)