meteor-fullcalendar
meteor-fullcalendar copied to clipboard
calendar id not available
My page shows a table of events, or a full calendar of events. The switch is controlled by a button which drives a session variable.
If I arrive on the page in table mode, it draws the table. When I press the button to full calendar mode the session variable is changed and it draws the full calendar, and also does a refetchEvents reactively.
The problem is that the refetch events seems to be called before the id of the full calendar is known, so it doesn't get set up correctly.
How can I know when the full calendar id is in the dom so I can call refetch events?
Note that if I arrive on the page in calendar mode, all is good because my code to call refetchEvents is in onRendered(). But it doesnt work if I switch to calendar mode after the page was rendered, even if I wrap the refetch code in an autorun - the id is not there yet.
It's hard to tell without seeing your code, but maybe using the viewRender callback would help.
Hi Krzysztof
I realize now its not an issue with refetch events but with what happens if I add the calendar to the page reactively.
It seems if I setup the page with the calendar at render time, the current events, and any new events I add after that are displayed on the calendar as expected.
But if I don't render the calendar initially, and switch to full calendar at a point after the page is initially rendered, existing events are displayed, but any new events are not. Calling refetchEvents after this will display the existing events and any new ones I just added, but again any new ones I add after that are not displayed.
Somehow my setup, if I add fullcalendar at some point later after the initial render of the page, it does not reactively display any new events I create - its an initialization issue.