Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refetchEvents when calendar Is hidden results in events disappearing. #2936

Closed
kylethielk opened this issue Nov 11, 2015 · 5 comments
Closed

Comments

@kylethielk
Copy link

JSBin: http://jsbin.com/mosuqujawa/edit?html,js,output

Using JSBin click the "Run Test" button. This will:

  1. Hide the Calendar.
  2. fullCalendar('refetchEvents')
  3. Show the Calendar.
  4. fullCalendar('render')

The calendar will be empty of events. If you navigate between views or forward/backward in time events appear again.

I was previously on 2.0.2 and this was not present, upgrading to 2.4 shows this behavior.

@kylethielk
Copy link
Author

Walking through the code it looks like in renderView() the following check is made:

if (!currentView.displaying ||
    !date.isWithin(currentView.intervalStart, currentView.intervalEnd)) 

The following will result in the events not ever being re-rendered after calendar is shown:

  1. Hide Calendar
  2. refetchEvents() calls destoryEvents()
  3. Once events are eventually retrieved from datasource renderEvents() is eventually called.
  4. renderEvents() checks to see if calendar is visible, since it is not nothing is rendered, calendar is currently empty.
  5. Show Calendar.
  6. Call fullCalendar('render') which eventually calls renderView(), since currentView.displaying == true && date.isWithin(currentView.intervalStart, currentView.intervalEnd) == true the code to render the events is never called.

I have worked around this by changing the check from:

if (!currentView.displaying ||
    !date.isWithin(currentView.intervalStart, currentView.intervalEnd)) 

to

    if (
    !currentView.isEventsRendered ||
    !currentView.displaying ||
    !date.isWithin(currentView.intervalStart, currentView.intervalEnd)) 

and it is working fine.

@dhawkKD
Copy link

dhawkKD commented Mar 17, 2016

I am trying to filter out events on some conditions by default it is coming as per expectation but after clicking on controls to filter out events it doesn't show any event. and If I move to next month and then comes back the current month it shows event. Tried the solution given above but didn't get any success.
This issue is actually coming in IE-11 only.

@arshaw arshaw closed this as completed May 29, 2016
@arshaw arshaw reopened this May 29, 2016
@arshaw
Copy link
Member

arshaw commented Jun 6, 2016

i confirmed @kylethielk's original case, thanks. i have not yet dug into the code or proposed solutions

@caseyjhol
Copy link
Contributor

This appears to have been resolved in v2.8.0 (most likely due to the removal of destroyEvents).

JSBin: http://jsbin.com/buvebesayi/edit?html,js,output

@arshaw
Copy link
Member

arshaw commented Jul 12, 2016

thanks for checking that @caseyjhol. closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants