class sap.ui.ux3.Collection

Control sample: sap.ui.ux3.Collection
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/ux3/Collection
Application Component: CA-UI5-CTR

Collection


Constructor

Constructor for a new Collection.

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.ux3.Collection(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
editable boolean false

If a collection is editable an edit button will be displayed below the list of items

Visibility: public
multiSelection boolean false

Allow multi selection of items in collection

Visibility: public
title string

Name for the collection

Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description
items 0..n sap.ui.core.Item

Items in the collection


Associations

Name Cardinality Type Description
selectedItems 0..n sap.ui.core.Item

Contains all items that are currently selected


Events Overview

Event Description
propertyChanged

Fires if a property has changed, and the collection inspector needs to do something after that

selectionChanged

Fired when ever the selected items changer

propertyChanged

Fires if a property has changed, and the collection inspector needs to do something after that

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

selectionChanged

Fired when ever the selected items changer

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

Methods Overview

Method Description
addItem

Adds some item to the aggregation items.

addSelectedItem
attachPropertyChanged

Attaches event handler fnFunction to the propertyChanged event of this sap.ui.ux3.Collection.

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.ux3.Collection itself.

Fires if a property has changed, and the collection inspector needs to do something after that

attachSelectionChanged

Attaches event handler fnFunction to the selectionChanged event of this sap.ui.ux3.Collection.

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.ux3.Collection itself.

Fired when ever the selected items changer

destroyItems

Destroys all the items in the aggregation items.

detachPropertyChanged

Detaches event handler fnFunction from the propertyChanged event of this sap.ui.ux3.Collection.

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

detachSelectionChanged

Detaches event handler fnFunction from the selectionChanged event of this sap.ui.ux3.Collection.

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

sap.ui.ux3.Collection.extend

Creates a new subclass of class sap.ui.ux3.Collection 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.Element.extend.

firePropertyChanged

Fires event propertyChanged to attached listeners.

fireSelectionChanged

Fires event selectionChanged to attached listeners.

getEditable

Gets current value of property editable.

If a collection is editable an edit button will be displayed below the list of items

Default value is false.

getItems

Gets content of aggregation items.

Items in the collection

sap.ui.ux3.Collection.getMetadata

Returns a metadata object for class sap.ui.ux3.Collection.

getMultiSelection

Gets current value of property multiSelection.

Allow multi selection of items in collection

Default value is false.

getSelectedItems

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

getTitle

Gets current value of property title.

Name for the collection

indexOfItem

Checks for the provided sap.ui.core.Item in the aggregation items. and returns its index if found or -1 otherwise.

insertItem

Inserts a item into the aggregation items.

removeAllItems

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

removeAllSelectedItems
removeItem

Removes a item from the aggregation items.

removeSelectedItem
setEditable

Sets a new value for property editable.

If a collection is editable an edit button will be displayed below the list of items

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

Default value is false.

setMultiSelection

Sets a new value for property multiSelection.

Allow multi selection of items in collection

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

Default value is false.

setTitle

Sets a new value for property title.

Name for the collection

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

addItem

Adds some item to the aggregation items.

Param Type DefaultValue Description
oItem sap.ui.core.Item

The item to add; if empty, nothing is inserted

addSelectedItem

Param Type DefaultValue Description
vSelectedItem string sap.ui.core.Item

Id of a selectedItem which becomes an additional target of this selectedItems association. Alternatively, a selectedItem instance may be given.

attachPropertyChanged

Attaches event handler fnFunction to the propertyChanged event of this sap.ui.ux3.Collection.

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.ux3.Collection itself.

Fires if a property has changed, and the collection inspector needs to do something after that

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.ux3.Collection itself

attachSelectionChanged

Attaches event handler fnFunction to the selectionChanged event of this sap.ui.ux3.Collection.

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.ux3.Collection itself.

Fired when ever the selected items changer

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.ux3.Collection itself

destroyItems

Destroys all the items in the aggregation items.

detachPropertyChanged

Detaches event handler fnFunction from the propertyChanged event of this sap.ui.ux3.Collection.

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

detachSelectionChanged

Detaches event handler fnFunction from the selectionChanged event of this sap.ui.ux3.Collection.

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.ux3.Collection.extend

Creates a new subclass of class sap.ui.ux3.Collection 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.Element.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

firePropertyChanged

Fires event propertyChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireSelectionChanged

Fires event selectionChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

getEditable

Gets current value of property editable.

If a collection is editable an edit button will be displayed below the list of items

Default value is false.

getItems

Gets content of aggregation items.

Items in the collection

sap.ui.ux3.Collection.getMetadata

Returns a metadata object for class sap.ui.ux3.Collection.

getMultiSelection

Gets current value of property multiSelection.

Allow multi selection of items in collection

Default value is false.

getSelectedItems

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

getTitle

Gets current value of property title.

Name for the collection

indexOfItem

Checks for the provided sap.ui.core.Item in the aggregation items. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oItem sap.ui.core.Item

The item whose index is looked for

insertItem

Inserts a item into the aggregation items.

Param Type DefaultValue Description
oItem sap.ui.core.Item

The item to insert; if empty, nothing is inserted

iIndex int

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

removeAllItems

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

removeAllSelectedItems

removeItem

Removes a item from the aggregation items.

Param Type DefaultValue Description
vItem int string sap.ui.core.Item

The item to remove or its index or id

removeSelectedItem

Param Type DefaultValue Description
vSelectedItem int string sap.ui.core.Item

the selectedItem to remove or its index or id

setEditable

Sets a new value for property editable.

If a collection is editable an edit button will be displayed below the list of items

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

New value for property editable

setMultiSelection

Sets a new value for property multiSelection.

Allow multi selection of items in collection

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

New value for property multiSelection

setTitle

Sets a new value for property title.

Name for the collection

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

Param Type DefaultValue Description
sTitle string

New value for property title