search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How can I remove just one event from the scheduler without having to reload all events

Asked by Anonymous
11 years ago.

I have a context menu item that calls the following jscript function to remove an event

function removeEvent(tgt) {
//$.ajaxSetup({ cache: false }); // must turn caching off to ensure json method is called each time
$.getJSON(this.location.href + 'Home/RemoveEvent/', { id: tgt.data.value }, function (data) {
if (data == true) {
// delete successful - remove from scheduler
dps.events.remove(tgt).notify();
}
});

When dps.events.remove(tgt).notify(); is called, I get the following exception:
Obviously I'm missing something in the controller, but your documentation really does not explain how to use this function.

System.Exception was unhandled by user code
HResult=-2146233088
Message=Unknown CallBack command 'EventRemove'.
Source=DayPilot.Web.Mvc
StackTrace:
at DayPilot.Web.Mvc.DayPilotScheduler.CallBack(Controller c)
at MvcAppDayPilot.Controllers.HomeController.Backend() in C:\Users\MARTHAC\Projects\MvcAppDayPilot\MvcAppDayPilot\Controllers\HomeController.cs:line 66
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
InnerException:

So I have two questions:
1 - What do I need to do to get this to work?
2 - Is there an easier way?

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.