rerenderEvents / refetchEvents problem

后端 未结 5 1961
情歌与酒
情歌与酒 2020-12-31 16:01

I am not sure if I am using this correctly so my problem may be my mis-understanding rather than a bug or larger problem.

I have a fullcalendar that gets initiated f

5条回答
  •  心在旅途
    2020-12-31 16:28

    $('#calendar').fullCalendar('removeEvents');
    $('#calendar').fullCalendar('addEventSource', 'JsonResponse.ashx?technicans=' + technicians);
    $('#calendar').fullCalendar('rerenderEvents');
    

    The above solution works, but every time you run it, it add an eventSource.

    So when you need to run $('#calendar').fullCalendar('refetchEvents'); you will get events from all sources, so many dublicate events and events from all previous sources.

    The solution that works for me good is:

    $('#calendar').fullCalendar('removeEventSource', 'JsonResponse.ashx?technicans=' + technicians);
    technicians = new_technicians_value;
    $('#calendar').fullCalendar('addEventSource', 'JsonResponse.ashx?technicans=' + technicians);
    

    And there is no need for "rerenderEvents" or "refetchEvents".

    After "addEventSource" events will be immediately fetched from the new source.

    After that "refetchEvents" will work as supposed to when needed.

提交回复
热议问题