2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
.. _triggered-actions:
|
|
|
|
|
2009-09-14 00:25:49 +02:00
|
|
|
Triggered Actions
|
|
|
|
=================
|
|
|
|
|
|
|
|
The following options are *functions* that get executed every time something
|
|
|
|
special happens. For every triggered action, a final ``view`` parameter is
|
2009-09-14 05:36:27 +02:00
|
|
|
always available (:ref:`more below <view-object>`).
|
|
|
|
|
|
|
|
**viewDisplay**: function(*view*)
|
|
|
|
Triggered once when the calendar loads and every time the
|
|
|
|
calendar's view is changed. This includes when the prev or next
|
|
|
|
button is pressed.
|
|
|
|
|
|
|
|
**loading**: function(*isLoading, view*)
|
|
|
|
Triggered with a ``true`` argument when the calendar begins fetching
|
|
|
|
events via AJAX. Triggered with ``false`` when done.
|
|
|
|
|
|
|
|
**windowResize**: function(*view*)
|
|
|
|
Triggered after the calendar's dimensions have been changed due to
|
|
|
|
the containing window being resized.
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
``this`` is set to the main element.
|
|
|
|
|
2009-10-19 07:33:14 +02:00
|
|
|
**dayClick**: function(*dayDate, allDay, jsEvent, view*)
|
|
|
|
Triggered when the user clicks on a day. ``dayDate`` is a Date object holding the
|
|
|
|
current date and time (if in an agenda view) of the clicked area.
|
|
|
|
|
|
|
|
``allDay`` will be ``true`` when the user clicks on a day in month-view
|
|
|
|
or the "all-day" slot in the agenda views. It will be ``false`` when the user
|
|
|
|
clicks on a slot in the agenda views.
|
|
|
|
|
|
|
|
``jsEvent`` is the native javascript event (with information about click position, etc).
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
``this`` is set to the TD element of the clicked day.
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
**eventRender**: function(*calEvent, element, view*)
|
|
|
|
Triggered before an element is rendered for the given :ref:`CalEvent <CalEvents>`.
|
|
|
|
``element`` is the jQuery element that will be used by default. You may modify
|
|
|
|
this element or return a brand new element that will be used instead.
|
|
|
|
Returning ``false`` will prevent the event from being rendered at all.
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
This function is great for attaching other jQuery plugins to each event
|
|
|
|
element, such as a `qTip <http://craigsworks.com/projects/qtip/docs/>`_
|
|
|
|
tooltip effect.
|
|
|
|
|
|
|
|
**eventClick**, **eventMouseover**, **eventMouseout**: function(*calEvent, jsEvent, view*)
|
|
|
|
Triggered on click/mouseover/mouseout actions for an event.
|
|
|
|
``calEvent`` holds that event's information (date, title, etc).
|
|
|
|
``jsEvent`` holds the native javascript event (with information about click position, etc).
|
|
|
|
|
|
|
|
``this`` is set to the event's element
|
|
|
|
|
|
|
|
For ``eventClick``, return ``false`` to prevent the browser from going to
|
|
|
|
the event's URL.
|
|
|
|
|
|
|
|
**eventDragStart**, **eventDragStop**: function(*calEvent, jsEvent, ui, view*)
|
2009-10-19 07:33:14 +02:00
|
|
|
Triggered before/after an event is dragged (but not necessarily moved to a new day/time).
|
2009-09-14 05:36:27 +02:00
|
|
|
``calEvent`` holds that event's information (date, title, etc).
|
|
|
|
``jsEvent`` holds the native javascript event (with information about click position, etc).
|
|
|
|
``ui`` holds the jQuery UI object.
|
|
|
|
|
|
|
|
``this`` is set to the event's element
|
|
|
|
|
2009-10-19 07:33:14 +02:00
|
|
|
**eventDrop**: function(*calEvent, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view*)
|
|
|
|
Triggered when dragging stops and the event has moved to a *different* day/time.
|
2009-09-14 05:36:27 +02:00
|
|
|
|
|
|
|
``dayDelta`` holds the number of days the event was moved forward (a positive number)
|
|
|
|
or backwards (a negative number).
|
|
|
|
|
2009-10-19 07:33:14 +02:00
|
|
|
``minuteDelta`` holds the number of minutes the event was moved forward (a positive number)
|
|
|
|
or backwards (a negative number). Only applies to the agenda views.
|
2009-09-14 05:36:27 +02:00
|
|
|
|
|
|
|
``dayDelta`` and ``minuteDelta`` are elegant for dealing with multi-day and
|
|
|
|
repeating events. If updating a remote database, just add these values to the
|
|
|
|
start and end times of all events with the given ``calEvent.id``
|
2009-09-21 06:57:20 +02:00
|
|
|
|
2009-10-19 07:33:14 +02:00
|
|
|
``allDay`` is ``true`` if the event has been dropped on a day in month-view or the
|
|
|
|
"all-day" slot in the agenda views. It will be ``false`` if dropped on a slot
|
|
|
|
in the agenda views.
|
|
|
|
|
2009-09-21 06:57:20 +02:00
|
|
|
``revertFunc`` is a function that, if called, reverts the event's start/end date to
|
|
|
|
the values *before* the drag. This is useful if an ajax call should fail.
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
**eventResizeStart**, **eventResizeStop**: function(*calEvent, jsEvent, ui, view*)
|
|
|
|
Triggered before/after an event is resized (but not necessarily changed).
|
|
|
|
``calEvent`` holds that event's information (date, title, etc).
|
|
|
|
``jsEvent`` holds the native javascript event (with information about click position, etc).
|
|
|
|
``ui`` holds the jQuery UI object.
|
|
|
|
|
|
|
|
``this`` is set to the event's element
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-21 06:57:20 +02:00
|
|
|
**eventResize**: function(*calEvent, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view*)
|
2009-09-14 05:36:27 +02:00
|
|
|
Triggered when an event is resized and *changed in duration*.
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
``dayDelta`` holds the number of days the event's end time was moved
|
|
|
|
forward (a positive number) or backwards (a negative number).
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-10-19 07:33:14 +02:00
|
|
|
``minuteDelta`` holds the number of minutes the event's end time was moved
|
|
|
|
forward (a positive number) or backwards (a negative number).
|
|
|
|
Only applies to the agenda views.
|
2009-09-21 06:57:20 +02:00
|
|
|
|
|
|
|
``revertFunc`` is a function that, if called, reverts the event's start/end date to
|
|
|
|
the values *before* the drag. This is useful if an ajax call should fail.
|
2009-09-14 05:36:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
.. _view-object:
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
View Object
|
|
|
|
===========
|
|
|
|
|
|
|
|
The final parameter of every triggered action is a *view* object. It contains information about the
|
|
|
|
current view (whether month/basicWeek/basicDay) and contains the following properties:
|
|
|
|
|
|
|
|
**name**: String
|
|
|
|
Name of one of the available views (month, basicWeek, basicDay)
|
|
|
|
|
|
|
|
**title**: String
|
|
|
|
Title text that is displayed at the top of the header
|
|
|
|
(such as "September 2009" or "Sep 7 - 13 2009").
|
|
|
|
|
|
|
|
**start**: Date
|
|
|
|
The Date of the first day of the month/week.
|
|
|
|
If day-view, the Date of the single day.
|
|
|
|
|
|
|
|
**end**: Date
|
|
|
|
The Date of the day *after* the last day of the month/week.
|
|
|
|
If day-view, the Date *after* the single day.
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
Because this is an *exclusive* value, if the calendar has a
|
|
|
|
month-view on October 2009, ``end`` will be November 1st.
|
|
|
|
|
|
|
|
**visStart**: Date
|
|
|
|
The Date of the first *visible* day of the view. In month-view,
|
|
|
|
this value is often before the 1st day of the month, because most
|
|
|
|
months do not begin on a Monday.
|
2009-09-14 00:25:49 +02:00
|
|
|
|
2009-09-14 05:36:27 +02:00
|
|
|
In week and day views, this value will always be the same as ``start``.
|
|
|
|
|
|
|
|
**visEnd**: Date
|
|
|
|
The Date of the day *after* the last visible day
|
|
|
|
(because it is exclusive like ``end``).
|