119 lines
4.7 KiB
Text
119 lines
4.7 KiB
Text
|
|
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`.
|
|
|
|
**getView** - .fullCalendar('getView')
|
|
Returns the :ref:`View Object <view-object>` for the current view.
|
|
This is useful if you want to get information about the calendar's title
|
|
or start/end dates.
|
|
|
|
**getDate** - .fullCalendar('getDate')
|
|
Returns a Date object for the current date of the calendar. For month view,
|
|
it will always be sometime between the first and last day of the month. For week view,
|
|
it will always be sometime between the first and last day of the week.
|
|
|
|
**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 if is is not already visible.
|
|
If the calendar *is* already visible, readjusts its size.
|
|
|
|
This method is useful in the scenario where a tab setup might hide/show
|
|
a calendar. Call this method whenever the calendar's tab is shown.
|
|
|
|
|
|
.. _option-getters-setters:
|
|
|
|
Dynamically Getting/Setting Properties
|
|
--------------------------------------
|
|
|
|
You may dynamically *retrieve* any of a FullCalendar's options using the following form::
|
|
|
|
$('#calendar').fullCalendar('option', 'optionName'); // returns the value
|
|
|
|
You may dynamically *set* some of FullCalendar's options using the following form::
|
|
|
|
$('#calendar').fullCalendar('option', 'optionName', 'optionValue');
|
|
|
|
**HOWEVER**, setting only works for the three following options: **apsectRatio**, **contentHeight**, and **height**.
|
|
|
|
The next version of FullCalendar will have more advancements in this area.
|
|
|