|
Calendar object JavaScript API supports the following calls:
-
getCurrentDate() returns the full date currently being viewed
-
getCurrentMonth(asMonthLabel) returns a number of the month currently being viewed(for asMonthLabel true - returns month as its label)
-
getCurrentYear() returns a number of the year currently being viewed
-
changeCurrentDate(yearOffset, monthOffset) sets a new current month to be displayed.
-
doCollapse(), doExpand() collapse or expand the calendar in a popup mode.
-
doSwitch() inverts a state for the popup calendar.
-
getNextMonth(asMonthLabel), getPreviousMonth(asMonthLabel) returns the previous and next month for the currently being viewed one.
-
getNextYear, getPreviousYear returns the previous and next years for the currently being viewed one.
-
getSelectedDate(), getSelectedDateString(pattern) returns the currently selected date as date or as String. In case of empty pattern, it is returned in the current locale pattern.
-
nextMonth() navigates to the next month
-
nextYear() navigates to the next year
-
prevMonth() navigates to the previous month
-
prevYear() navigates to the previous year
-
render(), renderFooter(), renderOptionalFooter(), renderHeader(), renderOptionalHeader() - functions to initiate client side rendering of the calendar or additional elements.
-
resetSelectedDate() - clears a selected day value.
-
selectDate(date, noUpdate, eventData) selects the date specified. If the date isn't in the current
month, performs a request to select some. if noUpdate is true, a request isn't fired for data, only client side rendering is invoked.
-
showSelectedDate() switch calendar to show currently selected date.
-
today(noUpdate, noHighlight) switch calendar to todayDate. If parameters are "true", request is not fired to switch, and additional highlighting is off.
You can access the calendar object using $(calendar_client_id).component
call from any place outside of the component itself.
- If you develop the macrodefinition for the calendar object, you can use:
Richfaces.getComponent('calendar',element).api_function_name(parameters)
- For example, the following call is
used on the "Next Year" button on the popup calendar panel:
Richfaces.getComponent('calendar',this).nextYear();
The second parameter
is an element inside the calendar. Richfaces.invokeOnComponent tries to find
the component in the parents hierarchy with type specified with the first parameter and
invokes the function defined with the third parameter.
|