fullcalendar/docs/methods.txt

89 lines
3.7 KiB
Plaintext
Executable File

Methods
=======
The following are methods that can be called on a FullCalendar-initialized
jQuery object:
**prev** - .fullCalendar('prev')
Moves the calendar one step back (either by a month, week, or day).
**next** - .fullCalendar('next')
Moves the calendar one step forward (either by a month, week, or day).
**today** - .fullCalendar('today')
Moves the calendar to the current date.
**gotoDate** - .fullCalendar('gotoDate', *year, [month, [date]]*)
Moves the calendar to an arbitrary year/month/date.
``month`` is 0-based, meaning January=0, February=1, etc.
This method can also be called with a single argument, a Date object.
**incrementDate** - .fullCalendar('incrementDate', *years, [months, [days]]*)
Moves the calendar forward/backward an arbitrary amount of time.
**changeView** - .fullCalendar('changeView', *viewName*)
Immediately switches to a different view. ``viewName`` must be one of the
:ref:`available-views`.
**updateEvent** - .fullCalendar('updateEvent', *calEvent*)
Reports changes to a :ref:`CalEvent's <CalEvent>` standard properties.
This will cause the event to be rerendered on the calendar.
If there are repeating events on the calendar with the
same ID, these events will be changed as well.
``calEvent`` must be a :ref:`CalEvent <CalEvent>` retrieved from a
:ref:`Triggered Action<triggered-actions>` or from the ``clientEvents`` method.
**renderEvent** - .fullCalendar('renderEvent', *calEvent, [stick]*)
Renders a new event on the calendar. ``calEvent`` must have
at least a ``title`` and a ``start``.
By default, the event will disappear once the calendar refetches its event
sources (example: when prev/next is clicked). However, specifying ``stick`` as ``true``
will cause the event to be permanently fixed to the calendar.
**removeEvents** - .fullCalendar('removeEvents', *[idOrFilter]*)
If the second argument is omitted, all events are removed.
If the second argument is an ID, all events with
the same ID will be removed.
The second argument may also be a filter function that accepts
one :ref:`CalEvent <CalEvent>` argument and returns ``true`` if it
should be removed.
**clientEvents** - .fullCalendar('clientEvents', *[idOrFilter]*)
This method will return an array of :ref:`CalEvents <CalEvent>` that
FullCalendar has stored on the client-side (browser).
If the second argument is omitted, all events will be returned.
If the second argument is an ID, all events with the
same ID will be returned.
The second argument may also be a filter function that accepts
one :ref:`CalEvent <CalEvent>` argument and returns ``true`` if it should
be included in the result set.
**addEventSource** - .fullCalendar('addEventSource', *source*)
Adds an :ref:`Event Source <event-sources>`. ``source`` may be an array/string/function just as in
the ``events`` option. Events will be immediately fetched from this source
and placed on the calendar.
**removeEventSource** - .fullCalendar('removeEventSource', *source*)
Removes an :ref:`Event Source <event-sources>`. ``source`` must be a reference to the
original array/string/function. Events from the source will immediately be
removed from the calendar.
**rerenderEvents** - .fullCalendar(``'rerenderEvents'``)
Rerenders all events on the screen.
**refetchEvents** - .fullCalendar(``'refetchEvents'``)
Refetches events from all sources and rerenders them on the screen.
**render** - .fullCalendar(``'render'``)
Immediately renders the calendar. This method is automatically called if the $().fullCalendar
plugin is called on a visible element. However, if a hidden/invisible element is initialized
with FullCalendar, this method must be explicitly called as soon as the element becomes visible.