I’ve a page with a scheduler loaded one time, and I need to load another URL if I click a button. But when I click the button the scheduler load the same URL of the first time, although I called aonther URL. Example:
At the first page load the url loaded is events.xml:
10:18:29.582 GET http://dimas.cat/demo/events.xml [HTTP/1.1 304 Not Modified 131ms]
10:18:29.486 "http://dimas.cat/demo/events.xml"
When I click the button “Test second load”, althought I’ve changed the URL to load events2.xml, events.xml is loaded instead:
10:18:33.784 GET http://dimas.cat/demo/events.xml [HTTP/1.1 304 Not Modified 260ms]
10:18:33.732 "http://dimas.cat/demo/events2.xml"
function loadnew(param) {
if (param == 1)
var url = "http://dimas.cat/demo/events2.xml";
else
var url = "http://dimas.cat/demo/events.xml";
console.log(url);
scheduler.load(url);
scheduler.clearAll();
}
In dyn loading mode, call to clearAll triggers immediate data loading, so if you want to change the active url, clearAll need to be placed after scheduler.load. ( due to async. nature of load command, clearAll will be executed before real data loading )
Thx Stanislav, this is the way! Now it loads the correct URL, but when I load the page for the first time it call the URL two times.
09:30:07.618 GET http://dimas.cat/demo/events.xml [HTTP/1.1 304 Not Modified 130ms]
09:30:07.765 GET http://dimas.cat/demo/events.xml [HTTP/1.1 304 Not Modified 133ms]
I updated the demo: dimas.cat/demo/demo_load.htm
I solved this with this line of code, but I don’t know if it’s the better/optimum way to avoid this double call:
if (scheduler.getEvents().length > 0) scheduler.clearAll();
Returning to the topic, I need to scheduler.clearAll() don’t reload the events, only clear it. That is scheduler.clearAll() don’t have to load any events, only remove all the events from the scheduler.
That is caused by combination of setLoadMode and clearAll.
When you are using setLoadMode clearAll will cause data reloading ( without setLoadMode clearAll will remove data and will not trigger the code )
Hello,
from I can see, this is not related. This fix targeted an error which happened when you have dataprocessor request for some item in progress (ajax sent but not completed yet) and clear scheduler using scheduler.clearAll before the request is completed - dataProcessor did not register that scheduler has been emptied and tried to update non-existing event after receiving server response. Now it should work correctly.
Although, the issue with setLoadMode/clearAll seems to be fixed as well. It doesn’t trigger data loading if i call scheduler.clearAll() in this demo docs.dhtmlx.com/scheduler/sample … abase.html
I am still experimenting the same behavior. My code:
scheduler.setCurrentView(data_inici);
scheduler.load("<?php echo base_url(); ?>get_events/"+id, function(){
(...)
});
if ({first_load} === false) scheduler.clearAll();
If I remove the if ({first_load} === false) the scheduler calls get_events 2 times at the first load.
If I put the clearAll() method before scheduler.load() the url isn’t updated and get_events calls the last id loaded
If I remove clearAll() the get_events url is not loaded
scheduler.init(‘scheduler_here’, new Date(), “{{ calendarView() }}”);
scheduler.setLoadMode(“month”);
scheduler.load(“calendar/data”,“json”);
Just updated to 4.4.0
The events are filtered server-side and than i feed them to scheduler.parse(new_events,‘json’). the scheduler looks great…for a split second, than " /calendar/data?timeshift=-120&uid=1488895193918&from=2017-02-28&to=2017-03-31" gets called and all hope is lost!
If i remove “clearAll” OR “setLoadMode” everything is ok.
I saw the post with $$(“scheduler”).data.silent(function(){this.clearAll()} or something like that. But that seems like a workaround and even so, I can’t get that to work.
Thanks
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan