I have an application where I can have anywhere up to 30 jobs (sections) per week and several workers (events) per job.
I am showing 2 weeks at a time and pulling data via ajax from a php api that returns json data.
I have put an outline of my code below but was wondering if anyone can recommend any optimisations. I have tried using updateCollection instead of addSections but couldn’t seem to get it working. I don’t know if it would be any faster.
The data looks like the following:
- job (id, title)
– workitem (start, end, worker, description, custom data etc…)
– workitem - job
– workitem
– workitem
– workitem
I have a loadData function which does the following (pseudo code):
$.ajax(onComplete(jobs){
scheduler.clearAll(); // clear events
scheduler.deleteAllSections(); // clear sections
var events = [];
loop jobs
scheduler.addSection({key: job.id, label: job.id + ': ' + job.customer_name});
loop jobs.workitems
events.push(workitem);
end loop
end loop
scheduler.parse(events);
}
- create array of workitem (events)