Adjust the _load_url parameters on the first data request

Hi,

Is there any way to adjust the _load_url on the initial data request?

I can successfuly do this on the subsequent datarequests.

Kindly
//floyd

Hi,
you can invoke initial data request manually (on the client-side), and specify needed parameters to the scheduler.load method:
JS: scheduler.load("url", "json");
And remove this setting from the server-side config: DHXScheduler.LoadData = true;
docs.dhtmlx.com/scheduler/api__s … _load.html

That worked very well, but I cannot figure out how to retrieve the current start and end times in the timeline view.

I would like to send these to my controller in order to retrieve the correct events and also add some other items to the querystring.

When I used the _load_url and added the extra items the start and end dates came along automatically but when I use the load method it seems I will have to add the dates manually.

The question is how to retrieve these dates.

This is really important to us in order to use the control.

Kindly
//floyd

Hi,
is there a reason why you don’t using built-in helper for loading date range?
scheduler-net.com/docs/loading_d … g_datasets

It will trigger data loading when it’s needed and you could filter events on server side using dates that are sent in request parameters.
For example, check how it works in online demo
roombooking.scheduler-net.com/

If you’re going to do it manually, you can retreive displayed range using this method:
docs.dhtmlx.com/scheduler/api__s … state.html
There is also a helper for formatting dates
docs.dhtmlx.com/scheduler/api__s … other.html
docs.dhtmlx.com/scheduler/settings_format.html

And the code might look following way:[code]var to_str = scheduler.date.date_so_str("%Y.%m.%d"),
state = scheduler.getState();

var url = “url?from=” + to_str(state.min_date) + “&to=” + to_str(state.max_date);[/code]

Hi,

Thank’s for the quick replys. It is great.

I used this method before but I then have trouble adjusting the initial _load_url querystring.
I would need to add some information to this initial request, but cannot find any event where it is apropriate to intercept.

I think I will solve the problem by getting the dates manually and then construct the querystring from scratch.

Thanks again for the quick help.

Kindly
//floyd

Hi,

You can enable built-in dynamic loading and invoke initial loading from the client side
JS:scheduler.setLoadMode("month"); scheduler.load("someUrl?param=value", "json");
I wouldn’t implement dynamic loading manually, there might be some pitfalls that has been already considered in a built-in solution. If you call ‘setLoadMode’, calendar will automatically add date range parameters to _load_url. And also it remembers dates that has been already loaded so it won’t send unnecessary requests

docs.dhtmlx.com/scheduler/api__s … dmode.html
docs.dhtmlx.com/scheduler/api__s … _load.html