We’re using scheduler .NET with MVC 5 and are trying to disable the cache and force a refresh when the user changes the date. We have set this:
scheduler.PreventCache();
But when the user looks at one date goes to another date and then goes back to the first date, the Data method in the controller is never called. We also tried with:
[OutputCache(Duration = 0, VaryByParam = "*")]
public ContentResult Data()
But that doesn’t work either. Is there a way to force a refresh when the date changes?
hi,
by default scheduler loads all events at once, so it do not trigger loading when date has changed.
Try enabling dynamic loading mode:
scheduler-net.com/docs/loading_d … g_datasets
With this mode enabled scheduler will load events for displayed date range when user switches to it.
However, it won’t reload dates which already has been loaded, you can try override it by clearing previously loaded data on some client side event
JS:
//clear all previous data when loading new portion
scheduler.attachEvent("onXLS", function (){
scheduler.clearAll();
});
docs.dhtmlx.com/scheduler/api__s … event.html
Thanks for the reply. Have turned on dynamic loading since we have big data. Tried the clearAll() method on the preload event and it kind of worked. Everything was cleared and it tried to reload the data which was good, but then it cleared it again and another reload happened, and another clear all etc, that is, it ended in an eternal loop.
Hi,
it doesn’t seems to happening in the sample i’ve tried, probably you need to provide more details.
Also, what you can try is to clear previously loaded data when user changes the date, and check if the date or a view has actually changed.
That way the scheduler won’t trigger loading when the calendar is simply refreshed:
scheduler.attachEvent("onBeforeViewChange", function (old_mode, old_date, mode, date) {
if (old_mode != mode || +old_date != +date)
scheduler.clearAll();
return true;
});
docs.dhtmlx.com/scheduler/api__s … event.html
The sample is attached (you’ll need to restore a NuGet packages)
SchedulerNet.DynLoading.NoCache.zip (254 KB)
Great, the scheduler now calls the Data action on the Controller every time the date changes without going into a loop. thanks.