سؤال

I have a Timeline Scheduler and have created a previous and next buttons so that the user can navigate through the dates. To do that, I use this to jump to the selected date:

scheduler.updateView(selectedDate)

And then created a Get request to the controller action Data to retrieve the set of events of that specific date and of specific employee:

$.ajax({
   type: 'POST',
   url: '@Url.Action("Data", "RO")',
   dataType: 'html',
   data: { employeeId: empid sDate: selectedDate},
   success: function (jsonObj) {
        scheduler.clearAll(); //clears all events
        scheduler.parse(jsonObj, "json"); //renders the new set of events (jsonObj)
});

This works fine. I can see the events for the specific date. But under the covers, this series of functions triggers the controller action Data trice!

The reason is, the scheduler function updateView() and parse() calls the controller action Data by default and I dont want that because it causes the triple posting.

Is there a way to prevent those two from triggering that ajax request? Thanks in advance!

هل كانت مفيدة؟

المحلول

I just found the answer. When I was starting with DHTMLX scheduler for MVC, I added this line of code so that the scheduler will load the date I specified and not all the events in the database:

sched.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Day);

Since we handled the 'load-specific-date-only' rule on our select statement, the scheduler no longer needed this code. So when I commented it out, updateView() and parse() doesn't trigger an ajax request anymore.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top