class sap.ui.unified.calendar.YearPicker

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/unified/calendar/YearPicker
Application Component: CA-UI5-CTR

renders a YearPicker with ItemNavigation This is used inside the calendar. Not for stand alone usage. As in all date-time controls, all pubic JS Date objects that are given (e.g. setDate()) or read (e.g. getFirstRenderedDate) with values which are considered as date objects in browser(local) timezone.


Constructor

Constructor for a new YearPicker.

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

new sap.ui.unified.calendar.YearPicker(sId?, mSettings?)
Param Type Default Value Description
sId? string

id for the new control, generated automatically if no id is given

mSettings? object

initial settings for the new control


Properties

Name Type Default Value Description
_middleDate object

Date as CalendarDate object. Holds the rendered date in the middle of the grid.

Since: 1.84.0.

Visibility: hidden
columns int 4

number of years in each row 0 means just to have all years in one row, independent of the number

Since: 1.30.0.

Visibility: public
date object

Date as JavaScript Date object. For this date a YearPicker is rendered. If a Year is selected the date is updated with the start date of the selected year (depending on the calendar type).

Since: 1.34.0.

Visibility: public
intervalSelection boolean false

If set, interval selection is allowed

Since: 1.74.

Visibility: public
primaryCalendarType sap.ui.core.CalendarType

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

Since: 1.34.0.

Visibility: public
year int 2000

The year is initial focused and selected The value must be between 0 and 9999

Visibility: public
years int 20

number of displayed years

Since: 1.30.0.

Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description
selectedDates 0..n sap.ui.unified.DateRange

Date Ranges for selected dates of the YearPicker

Since: 1.74.


Events Overview

Event Description
pageChange

The pageChange event is fired if the displayed years are changed by user navigation.

Since: 1.38.0.

select

Year selection changed

pageChange

The pageChange event is fired if the displayed years are changed by user navigation.

Since: 1.38.0.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

select

Year selection changed

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

Methods Overview

Method Description
addSelectedDate

Adds some selectedDate to the aggregation selectedDates.

attachPageChange

Attaches event handler fnFunction to the pageChange event of this sap.ui.unified.calendar.YearPicker.

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.ui.unified.calendar.YearPicker itself.

The pageChange event is fired if the displayed years are changed by user navigation.

attachSelect

Attaches event handler fnFunction to the select event of this sap.ui.unified.calendar.YearPicker.

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.ui.unified.calendar.YearPicker itself.

Year selection changed

destroySelectedDates

Destroys all the selectedDates in the aggregation selectedDates.

detachPageChange

Detaches event handler fnFunction from the pageChange event of this sap.ui.unified.calendar.YearPicker.

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

detachSelect

Detaches event handler fnFunction from the select event of this sap.ui.unified.calendar.YearPicker.

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

sap.ui.unified.calendar.YearPicker.extend

Creates a new subclass of class sap.ui.unified.calendar.YearPicker 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.

firePageChange

Fires event pageChange to attached listeners.

fireSelect

Fires event select to attached listeners.

getColumns

Gets current value of property columns.

number of years in each row 0 means just to have all years in one row, independent of the number

Default value is 4.

getDate

Gets current value of property date.

Date as JavaScript Date object. For this date a YearPicker is rendered. If a Year is selected the date is updated with the start date of the selected year (depending on the calendar type).

getFirstRenderedDate

return the first date of the first rendered year Note: If the YearPicker is not rendered no date is returned

getIntervalSelection

Gets current value of property intervalSelection.

If set, interval selection is allowed

Default value is false.

sap.ui.unified.calendar.YearPicker.getMetadata

Returns a metadata object for class sap.ui.unified.calendar.YearPicker.

getPrimaryCalendarType

Gets current value of property primaryCalendarType.

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

getSelectedDates

Gets content of aggregation selectedDates.

Date Ranges for selected dates of the YearPicker

getYear

Gets current value of property year.

The year is initial focused and selected The value must be between 0 and 9999

Default value is 2000.

Since 1.34.0 replaced by <code>date</code> property
getYears

Gets current value of property years.

number of displayed years

Default value is 20.

indexOfSelectedDate

Checks for the provided sap.ui.unified.DateRange in the aggregation selectedDates. and returns its index if found or -1 otherwise.

insertSelectedDate

Inserts a selectedDate into the aggregation selectedDates.

nextPage

displays the next page

previousPage

displays the previous page

removeAllSelectedDates

Removes all the controls from the aggregation selectedDates.

Additionally, it unregisters them from the hosting UIArea.

removeSelectedDate

Removes a selectedDate from the aggregation selectedDates.

setColumns

Sets a new value for property columns.

number of years in each row 0 means just to have all years in one row, independent of the number

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

Default value is 4.

setIntervalSelection

Sets a new value for property intervalSelection.

If set, interval selection is allowed

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

Default value is false.

setPrimaryCalendarType

Sets a new value for property primaryCalendarType.

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

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

setYear

Sets a new value for property year.

The year is initial focused and selected The value must be between 0 and 9999

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

Default value is 2000.

Since 1.34.0 replaced by <code>date</code> property
setYears

Sets a new value for property years.

number of displayed years

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

Default value is 20.

addSelectedDate

Adds some selectedDate to the aggregation selectedDates.

Param Type DefaultValue Description
oSelectedDate sap.ui.unified.DateRange

The selectedDate to add; if empty, nothing is inserted

attachPageChange

Attaches event handler fnFunction to the pageChange event of this sap.ui.unified.calendar.YearPicker.

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.ui.unified.calendar.YearPicker itself.

The pageChange event is fired if the displayed years are changed by user navigation.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.unified.calendar.YearPicker itself

attachSelect

Attaches event handler fnFunction to the select event of this sap.ui.unified.calendar.YearPicker.

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.ui.unified.calendar.YearPicker itself.

Year selection changed

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.unified.calendar.YearPicker itself

destroySelectedDates

Destroys all the selectedDates in the aggregation selectedDates.

detachPageChange

Detaches event handler fnFunction from the pageChange event of this sap.ui.unified.calendar.YearPicker.

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

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachSelect

Detaches event handler fnFunction from the select event of this sap.ui.unified.calendar.YearPicker.

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

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

sap.ui.unified.calendar.YearPicker.extend

Creates a new subclass of class sap.ui.unified.calendar.YearPicker 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.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

firePageChange

Fires event pageChange to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireSelect

Fires event select to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

getColumns

Gets current value of property columns.

number of years in each row 0 means just to have all years in one row, independent of the number

Default value is 4.

getDate

Gets current value of property date.

Date as JavaScript Date object. For this date a YearPicker is rendered. If a Year is selected the date is updated with the start date of the selected year (depending on the calendar type).

getFirstRenderedDate

return the first date of the first rendered year Note: If the YearPicker is not rendered no date is returned

getIntervalSelection

Gets current value of property intervalSelection.

If set, interval selection is allowed

Default value is false.

sap.ui.unified.calendar.YearPicker.getMetadata

Returns a metadata object for class sap.ui.unified.calendar.YearPicker.

getPrimaryCalendarType

Gets current value of property primaryCalendarType.

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

getSelectedDates

Gets content of aggregation selectedDates.

Date Ranges for selected dates of the YearPicker

getYear

Gets current value of property year.

The year is initial focused and selected The value must be between 0 and 9999

Default value is 2000.

Since 1.34.0 replaced by <code>date</code> property

getYears

Gets current value of property years.

number of displayed years

Default value is 20.

indexOfSelectedDate

Checks for the provided sap.ui.unified.DateRange in the aggregation selectedDates. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oSelectedDate sap.ui.unified.DateRange

The selectedDate whose index is looked for

insertSelectedDate

Inserts a selectedDate into the aggregation selectedDates.

Param Type DefaultValue Description
oSelectedDate sap.ui.unified.DateRange

The selectedDate to insert; if empty, nothing is inserted

iIndex int

The 0-based index the selectedDate should be inserted at; for a negative value of iIndex, the selectedDate is inserted at position 0; for a value greater than the current size of the aggregation, the selectedDate is inserted at the last position

nextPage

displays the next page

previousPage

displays the previous page

removeAllSelectedDates

Removes all the controls from the aggregation selectedDates.

Additionally, it unregisters them from the hosting UIArea.

removeSelectedDate

Removes a selectedDate from the aggregation selectedDates.

Param Type DefaultValue Description
vSelectedDate int string sap.ui.unified.DateRange

The selectedDate to remove or its index or id

setColumns

Sets a new value for property columns.

number of years in each row 0 means just to have all years in one row, independent of the number

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

Default value is 4.

Param Type DefaultValue Description
iColumns int 4

New value for property columns

setIntervalSelection

Sets a new value for property intervalSelection.

If set, interval selection is allowed

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

Default value is false.

Param Type DefaultValue Description
bIntervalSelection boolean false

New value for property intervalSelection

setPrimaryCalendarType

Sets a new value for property primaryCalendarType.

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

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

Param Type DefaultValue Description
sPrimaryCalendarType sap.ui.core.CalendarType

New value for property primaryCalendarType

setYear

Sets a new value for property year.

The year is initial focused and selected The value must be between 0 and 9999

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

Default value is 2000.

Since 1.34.0 replaced by <code>date</code> property
Param Type DefaultValue Description
iYear int 2000

New value for property year

setYears

Sets a new value for property years.

number of displayed years

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

Default value is 20.

Param Type DefaultValue Description
iYears int 20

New value for property years