class sap.m.ListItemBase

Control sample: sap.m.ListItemBase
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/m/ListItemBase
Application Component: CA-UI5-TBL

ListItemBase contains the base features of all specific list items. Note: If not mentioned otherwise in the individual subclasses, list items must only be used in the items aggregation of sap.m.ListBase controls.


Constructor

Constructor for a new ListItemBase.

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.m.ListItemBase(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
counter int

Defines the counter value of the list items.

Visibility: public
highlight string None

Defines the highlight state of the list items.

Valid values for the highlight property are values of the enumerations sap.ui.core.MessageType or sap.ui.core.IndicationColor.

Accessibility support is provided through the associated highlightText property. If the highlight property is set to a value of sap.ui.core.MessageType, the highlightText property does not need to be set because a default text is used. However, the default text can be overridden by setting the highlightText property. In all other cases the highlightText property must be set.

Since: 1.44.0.

Visibility: public
highlightText string empty string

Defines the semantics of the highlight property for accessibility purposes.

Since: 1.62.

Visibility: public
navigated boolean false

The navigated state of the list item.

If set to true, a navigation indicator is displayed at the end of the list item. Note: This property must be set for one list item only.

Since: 1.72.

Visibility: public
selected boolean false

Defines the selected state of the list items. Note: Binding the selected property in single selection modes may cause unwanted results if you have more than one selected items in your binding.

Visibility: public
type sap.m.ListType Inactive

Defines the visual indication and behavior of the list items, e.g. Active, Navigation, Detail.

Visibility: public
unread boolean false

Activates the unread indicator for the list item, if set to true. Note: This flag is ignored when the showUnread property of the parent is set to false.

Visibility: public
visible boolean true

Whether the control should be visible on the screen. If set to false, a placeholder is rendered instead of the real control.

Visibility: public

Associations

Name Cardinality Type Description
ariaLabelledBy 0..n sap.ui.core.Control

Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledby).

Since: 1.28.0.


Events Overview

Event Description
detailPress

Fires when the user clicks on the detail button of the control.

detailTap

Fires when the user taps on the detail button of the control.

press

Fires when the user clicks on the control. Note: This event is not fired when the parent mode is SingleSelectMaster or when the includeItemInSelection property is set to true. If there is an interactive element that handles its own press event then the list item's press event is not fired. Also see sap.m.ListBase#attachItemPress.

tap

Fires when the user taps on the control.

detailPress

Fires when the user clicks on the detail button of the control.

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

detailTap

Fires when the user taps on the detail button of the control.

Instead, use <code>detailPress</code> event.
Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

press

Fires when the user clicks on the control. Note: This event is not fired when the parent mode is SingleSelectMaster or when the includeItemInSelection property is set to true. If there is an interactive element that handles its own press event then the list item's press event is not fired. Also see sap.m.ListBase#attachItemPress.

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

tap

Fires when the user taps on the control.

Instead, use <code>press</code> event.
Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

Methods Overview

Method Description
addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

attachDetailPress

Attaches event handler fnFunction to the detailPress event of this sap.m.ListItemBase.

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.m.ListItemBase itself.

Fires when the user clicks on the detail button of the control.

attachDetailTap

Attaches event handler fnFunction to the detailTap event of this sap.m.ListItemBase.

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.m.ListItemBase itself.

Fires when the user taps on the detail button of the control.

Since 1.20.0 Instead, use <code>detailPress</code> event.
attachPress

Attaches event handler fnFunction to the press event of this sap.m.ListItemBase.

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.m.ListItemBase itself.

Fires when the user clicks on the control. Note: This event is not fired when the parent mode is SingleSelectMaster or when the includeItemInSelection property is set to true. If there is an interactive element that handles its own press event then the list item's press event is not fired. Also see sap.m.ListBase#attachItemPress.

attachTap

Attaches event handler fnFunction to the tap event of this sap.m.ListItemBase.

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.m.ListItemBase itself.

Fires when the user taps on the control.

Since 1.20.0 Instead, use <code>press</code> event.
detachDetailPress

Detaches event handler fnFunction from the detailPress event of this sap.m.ListItemBase.

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

detachDetailTap

Detaches event handler fnFunction from the detailTap event of this sap.m.ListItemBase.

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

Since 1.20.0 Instead, use <code>detailPress</code> event.
detachPress

Detaches event handler fnFunction from the press event of this sap.m.ListItemBase.

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

detachTap

Detaches event handler fnFunction from the tap event of this sap.m.ListItemBase.

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

Since 1.20.0 Instead, use <code>press</code> event.
sap.m.ListItemBase.extend

Creates a new subclass of class sap.m.ListItemBase 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.

fireDetailPress

Fires event detailPress to attached listeners.

fireDetailTap

Fires event detailTap to attached listeners.

Since 1.20.0 Instead, use <code>detailPress</code> event.
firePress

Fires event press to attached listeners.

fireTap

Fires event tap to attached listeners.

Since 1.20.0 Instead, use <code>press</code> event.
getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getContentAnnouncement

Returns the accessibility announcement for the content.

Hook for the subclasses.

getCounter

Gets current value of property counter.

Defines the counter value of the list items.

getHighlight

Gets current value of property highlight.

Defines the highlight state of the list items.

Valid values for the highlight property are values of the enumerations sap.ui.core.MessageType or sap.ui.core.IndicationColor.

Accessibility support is provided through the associated highlightText property. If the highlight property is set to a value of sap.ui.core.MessageType, the highlightText property does not need to be set because a default text is used. However, the default text can be overridden by setting the highlightText property. In all other cases the highlightText property must be set.

Default value is "None".

getHighlightText

Gets current value of property highlightText.

Defines the semantics of the highlight property for accessibility purposes.

Default value is empty string.

sap.m.ListItemBase.getMetadata

Returns a metadata object for class sap.m.ListItemBase.

getNavigated

Gets current value of property navigated.

The navigated state of the list item.

If set to true, a navigation indicator is displayed at the end of the list item. Note: This property must be set for one list item only.

Default value is false.

getSelected

Gets current value of property selected.

Defines the selected state of the list items. Note: Binding the selected property in single selection modes may cause unwanted results if you have more than one selected items in your binding.

Default value is false.

getTabbables

Returns the tabbable DOM elements as a jQuery collection

getType

Gets current value of property type.

Defines the visual indication and behavior of the list items, e.g. Active, Navigation, Detail.

Default value is Inactive.

getUnread

Gets current value of property unread.

Activates the unread indicator for the list item, if set to true. Note: This flag is ignored when the showUnread property of the parent is set to false.

Default value is false.

getVisible

Gets current value of property visible.

Whether the control should be visible on the screen. If set to false, a placeholder is rendered instead of the real control.

Default value is true.

isSelected

Returns the state of the item selection as a boolean

Since 1.10.2 API Change makes this method unnecessary. Use the {@link #getSelected} method instead.
removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

setCounter

Sets a new value for property counter.

Defines the counter value of the list items.

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

setHighlight

Sets a new value for property highlight.

Defines the highlight state of the list items.

Valid values for the highlight property are values of the enumerations sap.ui.core.MessageType or sap.ui.core.IndicationColor.

Accessibility support is provided through the associated highlightText property. If the highlight property is set to a value of sap.ui.core.MessageType, the highlightText property does not need to be set because a default text is used. However, the default text can be overridden by setting the highlightText property. In all other cases the highlightText property must be set.

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

Default value is "None".

setHighlightText

Sets a new value for property highlightText.

Defines the semantics of the highlight property for accessibility purposes.

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

Default value is empty string.

setNavigated

Sets a new value for property navigated.

The navigated state of the list item.

If set to true, a navigation indicator is displayed at the end of the list item. Note: This property must be set for one list item only.

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

Default value is false.

setSelected

Sets a new value for property selected.

Defines the selected state of the list items. Note: Binding the selected property in single selection modes may cause unwanted results if you have more than one selected items in your binding.

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

Default value is false.

setType

Sets a new value for property type.

Defines the visual indication and behavior of the list items, e.g. Active, Navigation, Detail.

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

Default value is Inactive.

setUnread

Sets a new value for property unread.

Activates the unread indicator for the list item, if set to true. Note: This flag is ignored when the showUnread property of the parent is set to false.

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

Default value is false.

setVisible

Sets a new value for property visible.

Whether the control should be visible on the screen. If set to false, a placeholder is rendered instead of the real control.

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

Default value is true.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to add; if empty, nothing is inserted

attachDetailPress

Attaches event handler fnFunction to the detailPress event of this sap.m.ListItemBase.

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.m.ListItemBase itself.

Fires when the user clicks on the detail button of the control.

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.m.ListItemBase itself

attachDetailTap

Attaches event handler fnFunction to the detailTap event of this sap.m.ListItemBase.

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.m.ListItemBase itself.

Fires when the user taps on the detail button of the control.

Since 1.20.0 Instead, use <code>detailPress</code> event.
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.m.ListItemBase itself

attachPress

Attaches event handler fnFunction to the press event of this sap.m.ListItemBase.

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.m.ListItemBase itself.

Fires when the user clicks on the control. Note: This event is not fired when the parent mode is SingleSelectMaster or when the includeItemInSelection property is set to true. If there is an interactive element that handles its own press event then the list item's press event is not fired. Also see sap.m.ListBase#attachItemPress.

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.m.ListItemBase itself

attachTap

Attaches event handler fnFunction to the tap event of this sap.m.ListItemBase.

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.m.ListItemBase itself.

Fires when the user taps on the control.

Since 1.20.0 Instead, use <code>press</code> event.
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.m.ListItemBase itself

detachDetailPress

Detaches event handler fnFunction from the detailPress event of this sap.m.ListItemBase.

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

detachDetailTap

Detaches event handler fnFunction from the detailTap event of this sap.m.ListItemBase.

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

Since 1.20.0 Instead, use <code>detailPress</code> event.
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

detachPress

Detaches event handler fnFunction from the press event of this sap.m.ListItemBase.

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

detachTap

Detaches event handler fnFunction from the tap event of this sap.m.ListItemBase.

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

Since 1.20.0 Instead, use <code>press</code> event.
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.m.ListItemBase.extend

Creates a new subclass of class sap.m.ListItemBase 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

fireDetailPress

Fires event detailPress to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireDetailTap

Fires event detailTap to attached listeners.

Since 1.20.0 Instead, use <code>detailPress</code> event.
Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

firePress

Fires event press to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireTap

Fires event tap to attached listeners.

Since 1.20.0 Instead, use <code>press</code> event.
Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getContentAnnouncement

Returns the accessibility announcement for the content.

Hook for the subclasses.

getCounter

Gets current value of property counter.

Defines the counter value of the list items.

getHighlight

Gets current value of property highlight.

Defines the highlight state of the list items.

Valid values for the highlight property are values of the enumerations sap.ui.core.MessageType or sap.ui.core.IndicationColor.

Accessibility support is provided through the associated highlightText property. If the highlight property is set to a value of sap.ui.core.MessageType, the highlightText property does not need to be set because a default text is used. However, the default text can be overridden by setting the highlightText property. In all other cases the highlightText property must be set.

Default value is "None".

getHighlightText

Gets current value of property highlightText.

Defines the semantics of the highlight property for accessibility purposes.

Default value is empty string.

sap.m.ListItemBase.getMetadata

Returns a metadata object for class sap.m.ListItemBase.

getNavigated

Gets current value of property navigated.

The navigated state of the list item.

If set to true, a navigation indicator is displayed at the end of the list item. Note: This property must be set for one list item only.

Default value is false.

getSelected

Gets current value of property selected.

Defines the selected state of the list items. Note: Binding the selected property in single selection modes may cause unwanted results if you have more than one selected items in your binding.

Default value is false.

getTabbables

Returns the tabbable DOM elements as a jQuery collection

getType

Gets current value of property type.

Defines the visual indication and behavior of the list items, e.g. Active, Navigation, Detail.

Default value is Inactive.

getUnread

Gets current value of property unread.

Activates the unread indicator for the list item, if set to true. Note: This flag is ignored when the showUnread property of the parent is set to false.

Default value is false.

getVisible

Gets current value of property visible.

Whether the control should be visible on the screen. If set to false, a placeholder is rendered instead of the real control.

Default value is true.

isSelected

Returns the state of the item selection as a boolean

Since 1.10.2 API Change makes this method unnecessary. Use the {@link #getSelected} method instead.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy int sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to be removed or its index or ID

setCounter

Sets a new value for property counter.

Defines the counter value of the list items.

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

Param Type DefaultValue Description
iCounter int

New value for property counter

setHighlight

Sets a new value for property highlight.

Defines the highlight state of the list items.

Valid values for the highlight property are values of the enumerations sap.ui.core.MessageType or sap.ui.core.IndicationColor.

Accessibility support is provided through the associated highlightText property. If the highlight property is set to a value of sap.ui.core.MessageType, the highlightText property does not need to be set because a default text is used. However, the default text can be overridden by setting the highlightText property. In all other cases the highlightText property must be set.

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

Default value is "None".

Param Type DefaultValue Description
sHighlight string "None"

New value for property highlight

setHighlightText

Sets a new value for property highlightText.

Defines the semantics of the highlight property for accessibility purposes.

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

Default value is empty string.

Param Type DefaultValue Description
sHighlightText string ""

New value for property highlightText

setNavigated

Sets a new value for property navigated.

The navigated state of the list item.

If set to true, a navigation indicator is displayed at the end of the list item. Note: This property must be set for one list item only.

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
bNavigated boolean false

New value for property navigated

setSelected

Sets a new value for property selected.

Defines the selected state of the list items. Note: Binding the selected property in single selection modes may cause unwanted results if you have more than one selected items in your binding.

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
bSelected boolean false

New value for property selected

setType

Sets a new value for property type.

Defines the visual indication and behavior of the list items, e.g. Active, Navigation, Detail.

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

Default value is Inactive.

Param Type DefaultValue Description
sType sap.m.ListType Inactive

New value for property type

setUnread

Sets a new value for property unread.

Activates the unread indicator for the list item, if set to true. Note: This flag is ignored when the showUnread property of the parent is set to false.

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
bUnread boolean false

New value for property unread

setVisible

Sets a new value for property visible.

Whether the control should be visible on the screen. If set to false, a placeholder is rendered instead of the real control.

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

Default value is true.

Param Type DefaultValue Description
bVisible boolean true

New value for property visible