Denis Brown
Denis Brown

Reputation: 21

FullCalendar: how to fetch new events by AJAX in the moment of month changing?

I am learning FullCalendar JS plugin by Adam Shaw now. And first at all I want to say "Thanks a lot" to the plugin author.

What is a Calendar view? This is a list of records (calendar events). And I have to control this list size, or I hit limits (no more than 1000 records can be passed from Controller to View).

I see two ways:

(1) Traditional Selectors above calendar ('Please select month' - and I retrieve from Database only that month records (calendar events). Good - but if to start switching months inside Calendar - the other months will be empty (have no events)...

(2) To make 'pagination' of calendar events from month to month:

2-1. If you switch months by "<>" buttons (inside Calendar section) - a page makes postback (rerender full page or rerender only calendar section by AJAX) and retrieves records of picked month.

2-2. Probably the best way: If you switch months by "<>" buttons (regardless which calendar view - day, week, month - in use) - script upload new month records by ajax/json and place them in calendar. Don't know how to do that, but i am going to read over the documentation carefully.

If you have experience how overcome this problem of fetching to many records in Calendar events - please share.

Thanks

Upvotes: 2

Views: 3780

Answers (2)

sulaiman sudirman
sulaiman sudirman

Reputation: 1845

fullCalendar already has this feature, check this out, https://fullcalendar.io/docs/events-json-feed

Upvotes: 2

MarCrazyness
MarCrazyness

Reputation: 2182

you are looking for gotoDate (http://arshaw.com/fullcalendar/docs/current_date/gotoDate/) which will refetch your events for the given date object or year and month.

From documentation:

.fullCalendar( 'gotoDate', year [, month, [ date ]] )

Upvotes: 0

Related Questions