Event handling models
Refresh event model
The traditional refresh model is used when event handling is set to CallBack (e.g. EventMoveHandling="CallBack") or PostBack (ASP.NET WebForms only).
- An action is performed by the user (event moving, resizing).
- Event handler is fired and the details are sent to the server side.
- The server-side event handler updates the database and reloads the events.
- Updated event set is sent to the client side.
- All events are refreshed on the client side.
Notify event model
The fast notify refresh model is used when event handling is set to Notify (e.g. EventMoveHandling="Notify"). It can be used automatically for event moving (EventMoveHandling) and event resizing (EventResizeHandling). It can be also used for client side event updates.
- An action is performed by the user (event moving, resizing).
- The events are updated on the client side and the change is immediately visible.
- Event handler is fired and the details are sent to the server side.
- The server-side event handler updates the database. Client-side event refresh is optional.
Speed gains
The Notify model allows a super-fast UI feedback. Nothing has to be loaded from the server side and only the changed rows are redrawn.
While the same change may take several seconds using the traditional refresh model (server round-trip, events reloaded from a db, client-side reload) it will take only a few milliseconds with the notify model.
Notify event queue
Depending on the NotifyCommit property value the client-side changes can be sent to the server side immediately (NotifyCommit="Immediate") or they can be queued on the client side (NotifyCommit="Queue").
The queued events must be sent manually using client-side API:
dpc.queue.notify();
The "Notify" event model updates the client first and then notifies the server about the change. Compare this model with the traditional "Refresh" model where the change is first sent to the server, the server returns and updated event set and the client is refreshed.
Server-side event handlers
EventMove, EventResize
Both event moving (EventMoveHandling="Notify") and event resizing (EventResizeHandling="Notify") fire the standard event handlers on the server side:
Example (ASP.NET WebForms):
protected void DayPilotMonth1_EventMove(object sender, EventMoveEventArgs e) { // update the database eventMove(e.Value, e.NewStart, e.NewEnd); // send a confirmation to the client DayPilotMonth1.UpdateWithMessage("Event moved."); }
If you call UpdateWithMessage() or Update() without the CallBackUpdateType specified DayPilot Month will detect the Notify mode and it will not send the updated event set to the client.
It is possible to force client-side refresh using Update(CallBackUpdateType.EventsOnly) or Update(CallBackUpdateType.Full).
- This might be necessary if the action is forbidden (i.e. the required action will not be stored and the events need to be reset to the original state).
- Sometimes the change affects other events as well so they need to be updated.
- You may want to update resource details (e.g. row summaries).
EventAdd, EventRemove, EventUpdate
Individual actions submitted using DayPilot.Action.notify() invoke EventAdd, EventRemove, or EventUpdate event handlers (depending on action type).
See also Update Events without Reloading
Notify
The Notify event handler is fired when the action queue is submitted using DayPilot.Month.queue.notify().