I want to initialize a global array of events everytime new events are fetched from the database. T explain some more, i want my events in a global array on the client side so that i can filter events without an ajax call. For example, if i have events, and each event has a country associated with it, i have multiple select box where you can select one or more country. I use the clientEvents functions to filter events taht match the criteria but the problem comes when the user starts reducing the filters. Then i need the events that i have already filtered out and for that i dont want to make an ajax call. So my approach is to have a global array of events, and when the user clears the filters, i just simply refectch all the events from that array.
Now the problem is , where to initialize that array?? if i do it in eventAfterRender, it changes in when the filtered events are being rendered, if i do it in viewDisplay, it isnt even initialized, i dont know why, i read somewhere that viewDisplay gets called before the events are rendered if you are using json feed. So i am stuck.... Please any help would be great.
You could use a function as the feed: http://arshaw.com/fullcalendar/docs/event_data/events_function/
Then you can load the events from wherever you want and combine your array with data from a json source. It is up to your function to decide where to grab the data.
I suppose you will have to call the refetchEvents method after some external factors like choosing another country is done (your function providing events should take the selection of countries into concideration when generating the events to display).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With