Search code examples
fullcalendarfullcalendar-scheduler

Full Calendar - refetchResources


I am confused on how to refetch the resources by url (json feed).

This renders my calendar resources -

   $('#calendar').fullCalendar({
     ...
     resources: 'example.json?id=1',
     ...
   });

This documentation (https://fullcalendar.io/docs/refetchResources) says "If the resources option was specified as a JSON feed it will be requested again."

So I have a button that I want to click to change the resource url and reload the resource feed -

 $('.resource-button').on('click', function() {
    link = $(this).attr('href');
    $('#calendar').fullCalendar('refetchResources', {
      resources: link
    });
 });

Any idea why it doesn't reload the new resource link? The list of resources refreshes like it is doing something but the data stays the same.

Thanks


Solution

  •  $('.resource-button').on('click', function() {
        link = $(this).attr('href');
        $('#calendar').fullCalendar('option', 'resources', link);
        $('#calendar').fullCalendar('refetchResources');
     });