I wish to intercept the call to DataAction when the user clicks past the current range set in DynamicLoading. I need to add additional parameters to the call/url.
Is this possible without intercepting the native click events for the prev/next button and (re)implementing the dynamic load logic?
–
Thor Arne
Unfortunatelly there is no public api for this. It can be implemented only by using internal properties of the client-side sheduler. Data url stored in scheduler._load_url , you can catch next-previous button click with onBeforeViewChange event:scheduler.attachEvent("onBeforeViewChange", function (old_mode, old_date, new_mode , new_date){
scheduler._load_url = /*modify url, attach parameters*/;
return true;
});
docs.dhtmlx.com/scheduler/api__s … event.html
Thanks for your reply.
It appears that scheduler._load_url is undefined in the handler, and that it is actually set inside the .load() method. I’m not sure where to pick up and modify the Url used internally (Set serverside using “scheduler.DataAction = Url.Action(“GetLessonsForResource”, “Fravar”, new { area = “School” });”
Regardless we also need to load new data and refresh the scheduler based on external events (knockout observables) (as opposed to Next/Prev clicks). I am not able to do this, and will post a separate question.
–
Thor Arne Johansen
Oppad AS
Hi,
_load_url is undefined on first trigger of onBeforeViewChange event, which happens during initial render of the scheduler, but before loading data.
It should be defined when user clicks prev/next buttons.
Following code should allow adding additional parameter to data url scheduler.attachEvent("onBeforeViewChange", function (old_mode, old_date, new_mode , new_date){
if(scheduler._load_url){
scheduler._load_url = "@Html.Action("GetLessonsForResource", "Fravar")" +
"?mode="+new_mode;
}
return true;
});
For refreshing the scheduler you can use scheduler.clearAll and scheduler.load methods
scheduler.clearAll();
scheduler.load("@Html.Action("GetLessonsForResource", "Fravar")" + "?dynamic_params=...", "json");