How to get "from" and "to" params value for dynamic loading

I noticed that dynamic loading is possible when you use scheduler.load to make an API call to fetch data. I see that the library adds “from” and “to” param values in the request and helps with defining the range of events we would want to get.
Now I am making this API call using my own client and then formatting the data and passing it to the scheduler.parse() method. I would like to leverage the scheduler’s ability to calculate those “from” and “to” params to be able to paginate through events.

Is there any way that I can access those values? Are they stored somewhere? How does the scheduler fill these values in the request URL ?

Thanks
Aman

Hello @aman_gupta,

There is no public API that provides these values. So, you can get them from the URL passed to the server, that contains from/to dates:

Or you can manually calculate it, in order to do that, you should know the current date of your view, that you can get by the getState method:
https://docs.dhtmlx.com/scheduler/api__scheduler_getstate.html
and manually calculate which dates will be loaded, based on the current load mode, for example:

var fromDate= scheduler.getState().date;
// month
var toDateMonth = scheduler.date.add(fromDate, 1, "month")

Or you can modify sources(what is not recommended) in order to get these values, in this case, you should search for the _load method:

scheduler._load = function(url, from) {

Kind regards,

1 Like