initialization - jquery fullcalendar: is init done? -
i use function change date 1 calender (jquery fullcalender arshaw).
function cal_gotodate(d){ console.log('cal_gotodate ' + curcal + ' ' + d); $('#calendar'+curcal).fullcalendar('gotodate', d); cal_settitle(); return false; }
the problem: calender loaded dynamicaly using ajax. can happen calender not loaded when user tries change date. therefore got error if not initialized:
typeerror: $(...).fullcalendar not function
i check if fullcalender $('#calendar'+curcal)
initialized.
i`m not sure best solution, works perfect - use fullcalendar loading callback , set global boolean flag, example:
<script type="text/javascript"> var globalflag = false; $(document).ready(function() { $('#calendar').fullcalendar({ //calendar initialization code loading: function (bool) { if (!bool){ globalflag = true; } else{ globalflag = false; } } }) }); </script>
and can check globalflag
status.
for example use loading callback show/hide progress indicator.
Comments
Post a Comment