Hi,
I’m currently using dynamic loading and dhtmlxAjax.get(…) in our scheduler. The source code is like following:
scheduler.setLoadMode("month");
scheduler._load_url = dataURL;
dhtmlxAjax.get(scheduler._load_url, function(loader){
//get custom attribute
...
//load scheduler with the same data
scheduler.parse(loader.xmlDoc.responseText);
})
I noticed that “dataURL” was called twice every time the scheduler was loaded. But if I commented out the line “scheduler.setLoadMode(“month”);”, the scheduler was loaded once only as it’s supposed to. Any ideas? Thanks!
It is occurs only for initial data loading, right?
This is caused by cache structure of dyn. loading, for initial loading, when you are using parse, data is not registered in cache, so logic of scheduler do not know about data range of loaded data and issues an extra request to be sure that all events for the visible period is loaded for sure.
Thanks Stanislav! You’re right. It only happens during initial loading. I’m just curious if there is a way to prevent it to happen?
Also, one more interesting observation from my side. After I set the dynamic loading mode to “month”, I was trying to see the “from” and “to” values passed along with the requests. Following are some of the logs:
Initial : May
2012-05-02 10:42:40,863
from Wed May 02 10:42:40 EDT 2012 to Wed May 02 10:42:40 EDT 2012
One month forward: June
2012-05-02 10:42:41,082
from Sun Apr 01 02:00:00 EDT 2012 to Sun Jul 01 02:00:00 EDT 2012
One more month forward: July
2012-05-02 10:47:59,806
from Sun Jul 01 02:00:00 EDT 2012 to Sat Sep 01 02:00:00 EDT 2012
The “from” and “to” values somehow are not as I imagined the beginning and end dates of each month.
The “from” and “to” values somehow are not as I imagined the beginning and end dates of each month.
Month view shows not only current month, but few days from previous|next month as well, so scheduler may load a few months at once to have info about those extra days as well.
It only happens during initial loading. I’m just curious if there is a way to prevent it to happen?
after setting data url you can add
scheduler._load_url = dataURL;
scheduler._loaded[scheduler.templates.load_format( new Date(2012,4,1) )] = true
where new Date - points to start of month for which you will load events in the first data bunch
you may have few such lines, for each month which is loaded with initial set of data