Trigger event after getting data from source and just before pasting it to calender


#1
$('button').on('click',function(){


    var URL = www.abc.com;

     scheduler.updateView();

     scheduler.clearAll();

    scheduler.load(URL,'xml');

});

This is how i’m getting my calendar update. But i need to trigger a custom event just after when data is successfully fetched and in the middle when it is going to paste that data in calendar.

Simply my case is…

Data fetched -> ( my custom event ) - > Fetched data updated to calendar

I’ll be grateful.
Regards


#2

Hi,

Try onXLS event https://docs.dhtmlx.com/scheduler/api__scheduler_onxls_event.html


#3

Thanks for the reply… But i have checked and tried this.
But i didn’t worked for my case. May be i’m not putting this in right place.
I’ve tried to bind this before scheduler loads the data…

Can u please tell me a little more about it ? i couldn’t find any nice example for this.


#4

In this case you need to send ajax request to the server manually as it described on the page
https://docs.dhtmlx.com/scheduler/server_integration.html#customrequestheadersandparameters in the example http://prntscr.com/mgh9sj
Load data from the server, do what you need and then pass to scheduler.parse if you want to load data on the page.


#5

Ok Thanks i will see this.
And can you please tell me is there any proper way to achieve that if i want to check that scheduler have finished its previous Data Call to server or not before sending another one?


#6

If you send several requests, unfortunately there is no way to check state of the request. But you can track requests by creating a flag inProgress for it:

var inProgress = false; 
scheduler.attachEvent("onXLS", function(){ inProgress = true; }); 
scheduler.attachEvent("onXLE", function(){ inProgress = false; });

then check

if(inProgress){ do smth }

If you want just send requests one by one, try to use callback

scheduler.load("url", "json", function() { scheduler.load("anotherUrl", "json"); });