Scheduler: AJAX Event Moving

Drag & drop event moving is disabled by default.

It can be enabled using EventMoveHandling property. It has to be set to one of the following values:

  • CallBack
  • JavaScript

CallBack event handling will fire a server-side event handler (OnEventMove) using an AJAX callback.

JavaScript event handling will fire the JavaScript code specified in EventMoveJavaScript.

  • The following variables are available to the client-side handler: e, newStart, newEnd, newResource, external, ctrl, shift (see DayPilot.Scheduler.onEventMove)
  • The client side handler can call the server-side handler using eventMoveCallBack() method

Server-Side Handler

The EventMove event can be handled by overriding the OnEventMove method in the DayPilotScheduler implementing class:

protected override void OnEventMove(EventMoveArgs e)
{
  new EventManager(Controller).EventMove(e.Id, e.NewStart, e.NewEnd, e.NewResource);
  Update();
}

protected override void OnFinish()
{
  // only load the data if an update was requested by an Update() call
  if (UpdateType == CallBackUpdateType.None)
  {
    return;
  }

  Events = new EventManager(Controller).FilteredData(StartDate, EndDate, (string)ClientState["filter"]).AsEnumerable();

  DataStartField = "start";
  DataEndField = "end";
  DataTextField = "text";
  DataIdField = "id";
  DataResourceField = "resource";
}

If any changes are made to the event data set (which is the typical case), it is necessary to redraw the event set on the client side using an Update() call.

See also:

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java