Class sap.me.CalendarModule: sap/me/Calendar

extends Control

This is the Calendar control

Deprecated API:Since version 1.26.0. This control was experimental since 1.12. Please use the sap.ui.unified.Calendar instead!

Constructor Summary
new sap.me.Calendar(sId?, mSettings?)Constructor for a new Calendar.
Event Summary
changeCurrentDate(oControlEvent)event fired when tap to next or previous button and currentDate is updated
changeRange(oControlEvent)when the range of selected dates changes
tapOnDate(oControlEvent)event fired when a date is tapped
Events borrowed from class sap.ui.core.Control
Method Summary
sap.me.Calendar.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.me.Calendar with name sClassName and enriches it with the information contained in oClassInfo.
sap.me.Calendar.getMetadata()Returns a metadata object for class sap.me.Calendar.
sap.me.Calendar.parseDate(strDate)Helper function to instantiate a Date from the string(s) provided by the getCurrentDate, getSelectedDates methods.
attachChangeCurrentDate(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the changeCurrentDate event of this sap.me.Calendar.
attachChangeRange(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the changeRange event of this sap.me.Calendar.
attachTapOnDate(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the tapOnDate event of this sap.me.Calendar.
detachChangeCurrentDate(fnFunction, oListener)Detaches event handler fnFunction from the changeCurrentDate event of this sap.me.Calendar.
detachChangeRange(fnFunction, oListener)Detaches event handler fnFunction from the changeRange event of this sap.me.Calendar.
detachTapOnDate(fnFunction, oListener)Detaches event handler fnFunction from the tapOnDate event of this sap.me.Calendar.
fireChangeCurrentDate(mArguments?)Fires event changeCurrentDate to attached listeners.
fireChangeRange(mArguments?)Fires event changeRange to attached listeners.
fireTapOnDate(mArguments?)Fires event tapOnDate to attached listeners.
getCurrentDate()Gets current value of property currentDate.
getDayHeight()Gets current value of property dayHeight.
getDays()Gets current value of property days.
getDayWidth()Gets current value of property dayWidth.
getDesign()Gets current value of property design.
getDisabledDates()Gets current value of property disabledDates.
getDisabledWeekDays()Gets current value of property disabledWeekDays.
getEnableMultiselection()Gets current value of property enableMultiselection.
getFirstDayOffset()Gets current value of property firstDayOffset.
getHideMonthTitles()Gets current value of property hideMonthTitles.
getHideNavControls()Gets current value of property hideNavControls.
getMonths()Gets current value of property months.
getMonthsPerRow()Gets current value of property monthsPerRow.
getMonthsToDisplay()Gets current value of property monthsToDisplay.
getSelectedDates()returns an array of the currently selected dates (dates are strings formatted as Date.toDateString())
getSelectionMode()Gets current value of property selectionMode.
getSingleRow()Gets current value of property singleRow.
getSwipeToNavigate()Gets current value of property swipeToNavigate.
getVisible()Gets current value of property visible.
getWeeksPerRow()Gets current value of property weeksPerRow.
getWidth()Gets current value of property width.
setCurrentDate(strDate)Sets the current date of the calendar.
setDayHeight(iDayHeight)Sets a new value for property dayHeight.
setDays(oDays)Sets a new value for property days.
setDayWidth(iDayWidth)Sets a new value for property dayWidth.
setDesign(sDesign)Sets a new value for property design.
setDisabledDates(oDisabledDates)Sets a new value for property disabledDates.
setDisabledWeekDays(oDisabledWeekDays)Sets a new value for property disabledWeekDays.
setEnableMultiselection(bEnableMultiselection)Sets a new value for property enableMultiselection.
setFirstDayOffset(iFirstDayOffset)Sets a new value for property firstDayOffset.
setHideMonthTitles(bHideMonthTitles)Sets a new value for property hideMonthTitles.
setHideNavControls(bHideNavControls)Sets a new value for property hideNavControls.
setMonths(oMonths)Sets a new value for property months.
setMonthsPerRow(iMonthsPerRow)Sets a new value for property monthsPerRow.
setMonthsToDisplay(iMonthsToDisplay)Sets a new value for property monthsToDisplay.
setSelectionMode(sSelectionMode)Sets a new value for property selectionMode.
setSingleRow(bSingleRow)Sets a new value for property singleRow.
setSwipeToNavigate(bSwipeToNavigate)Sets a new value for property swipeToNavigate.
setVisible(bVisible)Sets a new value for property visible.
setWeeksPerRow(iWeeksPerRow)Sets a new value for property weeksPerRow.
setWidth(sWidth)Sets a new value for property width.
toggleDatesRangeSelection(oDateStart, oDateEnd, bSelected)it toggles the selection of the dates within the passed range to selected/unselected
toggleDatesSelection(aDates, bSelected)it toggles the passed dates to selected/unselected
toggleDatesType(aDates, sType, bSelected)Change the type of the given dates
unselectAllDates()unselect all the dates
Constructor Detail
new sap.me.Calendar(sId?, mSettings?)
Constructor for a new Calendar.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.

The supported settings are:

In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.

Parameters:
{string}sId? id for the new control, generated automatically if no id is given
{object}mSettings? initial settings for the new control
Deprecated:
Since version 1.26.0. This control was experimental since 1.12. Please use the sap.ui.unified.Calendar instead!
Event Detail
changeCurrentDate(oControlEvent)
event fired when tap to next or previous button and currentDate is updated
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.currentDate new date
changeRange(oControlEvent)
when the range of selected dates changes
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.fromDate from date
{string}oControlEvent.getParameters.toDate to date
tapOnDate(oControlEvent)
event fired when a date is tapped
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.date date tapped
{boolean}oControlEvent.getParameters.didSelect if day was selected
Method Detail
sap.me.Calendar.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.me.Calendar with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.me.Calendar.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.me.Calendar.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
sap.me.Calendar.parseDate(strDate): Date
Helper function to instantiate a Date from the string(s) provided by the getCurrentDate, getSelectedDates methods. IMPORTANT: The only valid values for the created Date are: year, month, day. Disregard any other value: hours, minutes, seconds, milliseconds...
Parameters:
{String}strDate The date, produced by a former call to Date.toDateString.
Exceptions:
{Error} If the string provided does not match a toDateString produced string.
Returns:
{Date} The Date, parsed from the input string.
attachChangeCurrentDate(oData?, fnFunction, oListener?): sap.me.Calendar
Attaches event handler fnFunction to the changeCurrentDate event of this sap.me.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.me.Calendar itself.

event fired when tap to next or previous button and currentDate is updated

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.me.Calendar itself
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
attachChangeRange(oData?, fnFunction, oListener?): sap.me.Calendar
Attaches event handler fnFunction to the changeRange event of this sap.me.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.me.Calendar itself.

when the range of selected dates changes

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.me.Calendar itself
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
attachTapOnDate(oData?, fnFunction, oListener?): sap.me.Calendar
Attaches event handler fnFunction to the tapOnDate event of this sap.me.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.me.Calendar itself.

event fired when a date is tapped

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.me.Calendar itself
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
detachChangeCurrentDate(fnFunction, oListener): sap.me.Calendar
Detaches event handler fnFunction from the changeCurrentDate event of this sap.me.Calendar.

The passed function and listener object must match the ones used for event registration.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
detachChangeRange(fnFunction, oListener): sap.me.Calendar
Detaches event handler fnFunction from the changeRange event of this sap.me.Calendar.

The passed function and listener object must match the ones used for event registration.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
detachTapOnDate(fnFunction, oListener): sap.me.Calendar
Detaches event handler fnFunction from the tapOnDate event of this sap.me.Calendar.

The passed function and listener object must match the ones used for event registration.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
fireChangeCurrentDate(mArguments?): sap.me.Calendar
Fires event changeCurrentDate to attached listeners.

Expects the following event parameters:

  • currentDate of type stringnew date
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
fireChangeRange(mArguments?): sap.me.Calendar
Fires event changeRange to attached listeners.

Expects the following event parameters:

  • fromDate of type stringfrom date
  • toDate of type stringto date
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
fireTapOnDate(mArguments?): sap.me.Calendar
Fires event tapOnDate to attached listeners.

Expects the following event parameters:

  • date of type stringdate tapped
  • didSelect of type booleanif day was selected
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
getCurrentDate(): string
Gets current value of property currentDate.

the center date where the month/week will be built around

Returns:
{string} Value of property currentDate
getDayHeight(): int
Gets current value of property dayHeight.

the height of a day

Default value is 50.

Returns:
{int} Value of property dayHeight
getDays(): any
Gets current value of property days.

Array of day names, default value is sap.m.getLocaleData().getDays("abbreviated") Check sap.ui.core.LocaleData documentation for more info.

Returns:
{any} Value of property days
getDayWidth(): int
Gets current value of property dayWidth.

the width of a day

Default value is 45.

Returns:
{int} Value of property dayWidth
getDesign(): sap.me.CalendarDesign
Gets current value of property design.

Indicates the design of the calendar (mainly colors)

Default value is Approval.

Returns:
{sap.me.CalendarDesign} Value of property design
getDisabledDates(): any
Gets current value of property disabledDates.

Array of specific dates (strings or Date objects) that will be disabled/non interactive

Returns:
{any} Value of property disabledDates
getDisabledWeekDays(): any
Gets current value of property disabledWeekDays.

Array of weekDays (as integers where 0=Sunday, 1=Monday etc) to be disabled. Interaction will be disabled for these week days.

Returns:
{any} Value of property disabledWeekDays
getEnableMultiselection(): boolean
Gets current value of property enableMultiselection.

to enable multiselection feature

Default value is false.

Returns:
{boolean} Value of property enableMultiselection
getFirstDayOffset(): int
Gets current value of property firstDayOffset.

to offset the first day of the week (0 = sunday)

Default value is 0.

Returns:
{int} Value of property firstDayOffset
getHideMonthTitles(): boolean
Gets current value of property hideMonthTitles.

hides the area of month titles

Default value is false.

Returns:
{boolean} Value of property hideMonthTitles
getHideNavControls(): boolean
Gets current value of property hideNavControls.

hides the area of navigation controls

Default value is false.

Returns:
{boolean} Value of property hideNavControls
getMonths(): any
Gets current value of property months.

Array of month names, default value is sap.m.getLocaleData().getMonths("abbreviated") Check sap.ui.core.LocaleData documentation for more info.

Returns:
{any} Value of property months
getMonthsPerRow(): int
Gets current value of property monthsPerRow.

months to display in a row. This sets the width of the whole control in order to contain the desired number of months per row

Default value is 1.

Returns:
{int} Value of property monthsPerRow
getMonthsToDisplay(): int
Gets current value of property monthsToDisplay.

number of months in a row.

Default value is 1.

Returns:
{int} Value of property monthsToDisplay
getSelectedDates(): any
returns an array of the currently selected dates (dates are strings formatted as Date.toDateString())
Returns:
{any}
getSelectionMode(): sap.me.CalendarSelectionMode
Gets current value of property selectionMode.

Indicates the design of the calendar (mainly colors)

Default value is SINGLE.

Returns:
{sap.me.CalendarSelectionMode} Value of property selectionMode
getSingleRow(): boolean
Gets current value of property singleRow.

boolean that sets the view to week mode or month mode

Returns:
{boolean} Value of property singleRow
getSwipeToNavigate(): boolean
Gets current value of property swipeToNavigate.

When enabled, swipe gestures will navigate and not select

Default value is false.

Returns:
{boolean} Value of property swipeToNavigate
getVisible(): boolean
Gets current value of property visible.

visibility of the control

Default value is true.

Returns:
{boolean} Value of property visible
getWeeksPerRow(): int
Gets current value of property weeksPerRow.

weeks to display in a row

Default value is 1.

Returns:
{int} Value of property weeksPerRow
getWidth(): sap.ui.core.CSSSize
Gets current value of property width.

The width of the calendar

Default value is 100%.

Returns:
{sap.ui.core.CSSSize} Value of property width
setCurrentDate(strDate): sap.me.Calendar
Sets the current date of the calendar.
Parameters:
{String}strDate The Date to set, the format being identical to a date string produced by "toDateString".
Returns:
{sap.me.Calendar}this to allow method chaining.
setDayHeight(iDayHeight): sap.me.Calendar
Sets a new value for property dayHeight.

the height of a day

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 50.

Parameters:
{int}iDayHeight New value for property dayHeight
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setDays(oDays): sap.me.Calendar
Sets a new value for property days.

Array of day names, default value is sap.m.getLocaleData().getDays("abbreviated") Check sap.ui.core.LocaleData documentation for more info.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{any}oDays New value for property days
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setDayWidth(iDayWidth): sap.me.Calendar
Sets a new value for property dayWidth.

the width of a day

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 45.

Parameters:
{int}iDayWidth New value for property dayWidth
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setDesign(sDesign): sap.me.Calendar
Sets a new value for property design.

Indicates the design of the calendar (mainly colors)

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Approval.

Parameters:
{sap.me.CalendarDesign}sDesign New value for property design
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setDisabledDates(oDisabledDates): sap.me.Calendar
Sets a new value for property disabledDates.

Array of specific dates (strings or Date objects) that will be disabled/non interactive

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{any}oDisabledDates New value for property disabledDates
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setDisabledWeekDays(oDisabledWeekDays): sap.me.Calendar
Sets a new value for property disabledWeekDays.

Array of weekDays (as integers where 0=Sunday, 1=Monday etc) to be disabled. Interaction will be disabled for these week days.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{any}oDisabledWeekDays New value for property disabledWeekDays
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setEnableMultiselection(bEnableMultiselection): sap.me.Calendar
Sets a new value for property enableMultiselection.

to enable multiselection feature

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Parameters:
{boolean}bEnableMultiselection New value for property enableMultiselection
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setFirstDayOffset(iFirstDayOffset): sap.me.Calendar
Sets a new value for property firstDayOffset.

to offset the first day of the week (0 = sunday)

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 0.

Parameters:
{int}iFirstDayOffset New value for property firstDayOffset
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setHideMonthTitles(bHideMonthTitles): sap.me.Calendar
Sets a new value for property hideMonthTitles.

hides the area of month titles

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Parameters:
{boolean}bHideMonthTitles New value for property hideMonthTitles
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setHideNavControls(bHideNavControls): sap.me.Calendar
Sets a new value for property hideNavControls.

hides the area of navigation controls

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Parameters:
{boolean}bHideNavControls New value for property hideNavControls
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setMonths(oMonths): sap.me.Calendar
Sets a new value for property months.

Array of month names, default value is sap.m.getLocaleData().getMonths("abbreviated") Check sap.ui.core.LocaleData documentation for more info.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{any}oMonths New value for property months
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setMonthsPerRow(iMonthsPerRow): sap.me.Calendar
Sets a new value for property monthsPerRow.

months to display in a row. This sets the width of the whole control in order to contain the desired number of months per row

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 1.

Parameters:
{int}iMonthsPerRow New value for property monthsPerRow
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setMonthsToDisplay(iMonthsToDisplay): sap.me.Calendar
Sets a new value for property monthsToDisplay.

number of months in a row.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 1.

Parameters:
{int}iMonthsToDisplay New value for property monthsToDisplay
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setSelectionMode(sSelectionMode): sap.me.Calendar
Sets a new value for property selectionMode.

Indicates the design of the calendar (mainly colors)

When called with a value of null or undefined, the default value of the property will be restored.

Default value is SINGLE.

Parameters:
{sap.me.CalendarSelectionMode}sSelectionMode New value for property selectionMode
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setSingleRow(bSingleRow): sap.me.Calendar
Sets a new value for property singleRow.

boolean that sets the view to week mode or month mode

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{boolean}bSingleRow New value for property singleRow
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setSwipeToNavigate(bSwipeToNavigate): sap.me.Calendar
Sets a new value for property swipeToNavigate.

When enabled, swipe gestures will navigate and not select

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Parameters:
{boolean}bSwipeToNavigate New value for property swipeToNavigate
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setVisible(bVisible): sap.me.Calendar
Sets a new value for property visible.

visibility of the control

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Parameters:
{boolean}bVisible New value for property visible
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setWeeksPerRow(iWeeksPerRow): sap.me.Calendar
Sets a new value for property weeksPerRow.

weeks to display in a row

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 1.

Parameters:
{int}iWeeksPerRow New value for property weeksPerRow
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
setWidth(sWidth): sap.me.Calendar
Sets a new value for property width.

The width of the calendar

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 100%.

Parameters:
{sap.ui.core.CSSSize}sWidth New value for property width
Returns:
{sap.me.Calendar} Reference to this in order to allow method chaining
toggleDatesRangeSelection(oDateStart, oDateEnd, bSelected): void
it toggles the selection of the dates within the passed range to selected/unselected
Parameters:
{any}oDateStart starting date of the range. It can be Strings or Date objects.
{any}oDateEnd ending date of the range. It can be Strings or Date objects.
{boolean}bSelected selected/unselected. Optional, if omitted it inverts each date's current state
toggleDatesSelection(aDates, bSelected): void
it toggles the passed dates to selected/unselected
Parameters:
{any}aDates Array of the dates to be toggled. they can be Strings or Date objects.
{boolean}bSelected select/unselect. Optional, if omitted it inverts each date's current state
toggleDatesType(aDates, sType, bSelected): void
Change the type of the given dates
Parameters:
{any}aDates An array of dates in string representation
{sap.me.CalendarEventType}sType The type of event
{boolean}bSelected Add/remove the type, if ommited it will toggle
unselectAllDates(): void
unselect all the dates