
It is possible to add an event to the Scheduler on the client side without contacting the server.
var e = new DayPilot.Event({
start:new DayPilot.Date(),
end:(new DayPilot.Date()).addHours(5),
value: DayPilot.guid(),
text: "New Event", resource:'E'});
dps.events.add(e);It is possible to notify the server about this change. The events.add() method returns a DayPilot.Action object that can be used to send the notification.
dps.events.add(e).notify();
This call will fire EventUpdate event on the server side.
// add the action to the queue dps.events.add(e).queue();
This call will add the action details to the queue.
// send the queue to the server dps.queue.notify();
This queue.notify() call will send all queued actions to the server. It will fire Notify event.
protected void DayPilotScheduler1_Notify(object sender, DayPilot.Web.Ui.Events.Scheduler.NotifyEventArgs e)
{
foreach(DayPilotEventArgs ea in e.Queue)
{
if (ea is EventAddEventArgs)
{
EventAddEventArgs em = (EventAddEventArgs)ea;
DayPilotScheduler1_EventAdd(sender, em);
}
else if (ea is EventMoveEventArgs)
{
EventMoveEventArgs em = (EventMoveEventArgs) ea;
DayPilotScheduler1_EventMove(sender, em);
}
else if (ea is EventRemoveEventArgs)
{
EventRemoveEventArgs em = (EventRemoveEventArgs) ea;
DayPilotScheduler1_EventRemove(sender, em);
}
else if (ea is EventUpdateEventArgs)
{
DayPilotScheduler1_EventUpdate(sender, (EventUpdateEventArgs) ea);
}
}
string msg = String.Format("Queue saved ({0} actions).", e.Queue.Count);
DayPilotScheduler1.UpdateWithMessage(msg);
}