Hello,
So I have quite a bit of data to load on the scheduler and I understand that this can take time. I can have from 20 to 500 events to add to the scheduler, I use personnalized query to my server to optimize the request on each view. The GET/AJAX request takes no time. But loading the events in the calendar takes for ever and not only does it take a long time it freezes the browser. I thought the events were loading but it was just slow so I created a progress bar. But the browser hangs so I don’t even see it. The only way to see the events actually being loaded is to add breakpoints.
Can anyone help me with this? Is there a way to make my code better or at least make the spinner show as it is loading the events. When I add a console.log in the for each I can also see it in the console it is pretty fast.
[code]$.each( data, function( key, event ) {
var eventObj = scheduler.getEvent(event.Activity_Id_int);
var type = typeof(me.scheduler.getEvent(event.Activity_Id_int));
if(typeof(me.scheduler.getEvent(event.Activity_Id_int)) === 'undefined')
{
var text;
if(event.Titre != null)
text = event.Titre + " " + event.Ressource + '-' + event.Employe;
else
text = event.Ressource + ' - ' + event.Employe;
me.scheduler.addEvent({
id: event.Activity_Id_int,
start_date: Global.formatDateTime(event.Local_Start_DateTime),
end_date: Global.formatDateTime(event.Local_End_DateTime),
text : text,
color: Global.RandGandB_To_SchedulerRGB(event.Color_R,event.Color_G,event.Color_B),
desc_act : event.Desc_Act,
priorite: event.Priorite,
ressource_id: event.Resource_Id,
ressource_name: event.Ressource,
textColor: "black"
});
}
n++;
progress.update(n/data.length * 100);
console.log("Loading these events y'all");
});
$("canvas").remove();[/code]
Hi,
use scheduler.parse for loading many events into calendar docs.dhtmlx.com/scheduler/api__s … parse.html
scheduler.addEvent redraws the calendar each time is called, that woul break the performance if called from a loop
Thanks, Aliaksandr. It does load a lot faster that way. But now there’s another problem…
In my array for example I send these dates : start_date: “2015-03-05 08:00”, end_date: “2015-03-05 16:59” but when I do scheduler.parse when my scheduler is running and I do scheduler.getEvents()[0] my dates are not as I sent them : start_date: Thu Nov 03 2072 08:00:00 GMT-0400 (Eastern Daylight Time) end_date: Thu Nov 03 2072 16:59:00 GMT-0400 (Eastern Daylight Time)
In my configurations : scheduler.config.api_date = “%Y-%m-%d %H:%i”;
Any ideas why?