how do i get error handling in scheduler during load, i am trying to handle server error during load so that scheduler does not end up in infinite loop of loading indicator. is there a way to check what was server response (400, 200 etc) during scheduler load.
i tried call back which works only if server response was successfull, but that does not work when load request fails due to server not being available.
Thanks but that does not work, have you tried it and see it gives you handle to check if your ajax was successfull.
what i am trying is to:
display loading indicator
Call Scheduler.load
===
see if the ajax was success if yes then
3a. remove loading indicator
3b. let the scheduler render the data
else if ajax had error status != 200 then
3c. remove loading indicator
3d. display a message to user that something went wrong with remote data provider.
hope this help better understand what i am trying to do so that you can replicate on your end and suggest something that works.
Not trying to be -ve, my experience with this forum so far is post a question and then answer yourself. ( which i like to answer so that someone else can benefit). just giving my feed back so that you can improve this forum experience “only if anyone cares”
anyway enough of my crying…
here is how i got this done, i did it 2 different ways there would certainly a better way than this, till then here it is (fyi i am using json).
solution1:
function ajaxRespHandler(loader){
if(loader.xmlDoc.status == 200){
var jsonData = JSON.parse(loader.xmlDoc.responseText);
scheduler.parse(jsonData.data,“json”);
}else{
alert("ERROR!!! \n \n System Error code: " + loader.xmlDoc.status );
}
}
Hello,
the onLoadError event fires if an ajax loading or parsing of data fails.
In case all gone as expected - onXLE event will fire.
So the firing of onXLE event is a reliable enough indicator that the response is successful.
The expected approach for handling ajax loading is using following three events
onXLS - ajax started -> display an indicator
onXLE - ajax ended, all good, the data is parsed -> hide an indicator
onLoadError - something is bad, the data is not parsed -> hide an indicator, show some error message
If this scenario does not work for you - please elaborate.
My mistake, in case of ajax error all handlers will fire, in following order:
onXLS - onLoadError - onXLE
in case of correct loading it will be:
onXLS - nXLE
docs.dhtmlx.com/scheduler/snippet/cad6725e - click on ‘Ajax’ button to reproduce load error. It will try to load data from not existing url, so you’ll get quite genuine error
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan