| Issue 90: | Ability to specify pre-cached events (to avoid initial ajax call) | |
| 8 people starred this issue and may be notified of changes. | Back to list |
I want to know if it's possible to get events by month, for example, at
first time, I get events by the default month, then when I click in the
next month button, I want to call my method or url, to get the next events
for the month clicked, monthClicked function maybe,
monthClicked: funcntion(monthNumber)
{
events: "events/json_events_byMonth("+monthNumber+")"
}
I see only monthDisplay, but I don't sure if it's the best solution.
Sep 2, 2009
Ok, I fixed it, this was my solution, to get events by Month Clicked:
In the // Event Source CRUD in the fullcalendar.js
I create the following function:
// Remove all events By Source
removeAllEventSource: function() {
events = new Array();
clearEventElements();
renderEvents();
}
Also in the function render() , I added the following line:
if(options.prefetchEvents===true)
fetchEvents(renderEvents);
I created a options, in order to not fetch events, then
in the fullcalendar I have:
$('#calendar').fullCalendar({
//events: "eventos/json_events",
prefetchEvents:false,
monthDisplay:function(y,m,title)
{
var mes = parseInt(m)+1; // I add +1 because the month array initializate in 0
$('#calendar').fullCalendar('removeAllEventSource');
$('#calendar').fullCalendar('addEventSource', 'eventos/json_events_by_month/'+mes);
},
Well, then I get all events by the number of month clicked in the fullcalendar.
Cool :D
Sep 2, 2009
Check it here: http://www.rhnexos.com.mx/eventos I'm usign fullcalendar with MVC, In order to get the events from source, I just create a method to get the number of month and then just send the JSON, to the calendar.
Sep 8, 2009
ooh i see, you want to pre-cache the first month's events. this could be a cool optimization in the future. will leave this report open. thanks lucks17
Oct 31, 2009
will probably get to this around the time i start the server-side aspect of fullcalendar (who know when that will be)
Summary:
Ability to specify pre-cached events (to avoid initial ajax call)
Status: Accepted
Aug 13, 2013
(No comment was entered for this change.)
Labels:
-Type-Defect -Priority-Medium Type-Feature
Jul 10, 2014
I'm doing this using a custom function for events. If it's the first call to the function, it loads an array of initial events. Otherwise, it calls the AJAX to load events. Makes it so there's no initial delay because of the AJAX call. Kinda messy, though, would rather be able to set both an array and json url as event sources to get this same functionality. Right now, this library seems to ignore an event array if it's given alongside a JSON url or function?
Aug 21, 2015
Discussion for this issue has moved to the following URL: https://github.com/fullcalendar/fullcalendar/issues/361 This is because Google Code is shutting down. Apologies if you are being pestered with these notifications. This is a one-time event. Happy coding, Adam
Status:
ExportedToGithub
|
|
| ► Sign in to add a comment |
mmm, it's possible to do this in the future?: monthDisplay:function(){ // I need and option to get the actually month, when the next month clicked // var monthNumber = .fullCalendar('getMonth'); .fullCalendar( 'addEventSource', 'events/json_events_byMonth/'+monthNumber+' }