Callback Functions
Callback Methods
| loadEvents ( start, end, viewName) | |
| Summary | This function is responsible to provide the data to be displayed. |
| Parameters |
|
| Returns | Returns an Array of Group Objects. For more information about the structure, please see the Calendar Data Structure. |
| Description | This function is invoked after the calendar is rendered for the first time and also every time the view is changed. |
| onNewEvent(event, groups, allDay) | |
| Summary | This callback function is invoked when user is creating an event by either dragging on the calendar grid or clicking Quick Add on the calendar. |
| Parameters |
|
| Returns | void |
| Description |
Typical use of this function will be to display a form to collect additional information for an event. We can pre-populate the start time and end time in the form with the start and end returned in the event object. Note: There is one specific callback function for each view. With Web2Cal 2.0 or greater, you can specify one generic onNewEvent callback for all views.
|
| onUpdate( event ) | |
| Summary | This function is invoked when user drags an event to change its date and time. |
| Parameters |
|
| Returns | void |
| Description |
Typical use of this function will be to persist the new date and time for the event. Once the database is updated, you must, update it in Web2Cal's cache as well. This is done by invoking updateEvent on Web2Cal API. For more information on updateEvent click here. Note: Although implementing this method is optional, it is highly recommended you do implement. This is the only way to persist user's drag and drop action. |
| onPreview( calEvent, event, html) | |
| Summary | This function is invoked when user clicks on any event that is being displayed in the calendar. |
| Parameters |
|
| Returns | void |
| Description |
This method is a window to control the behavior of event preview being displayed. If you implement this function, you must explicitly call showPreview on Web2Cal API to display the preview. Click here for more information on showPreview method. Note: Implementing this method is optional. If you do no specify this method, Web2Cal will implicitly convert the preview with event's information and display. There is a unique onPreview function for each view in Web2Cal. There is a specific callback for each view in the calendar. So, the following callbacks are similar to this one.
With Web2Cal premium 2.0 onwards, you can just specify a generic "onPreview" callback for all views. |