class sap.ui.table.plugins.MultiSelectionPlugin

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/table/plugins/MultiSelectionPlugin
Application Component: CA-UI5-TBL

Implements a plugin to enable a special multi-selection behavior:

This plugin is intended for the multi-selection mode, but also supports single selection for ease of use. When this plugin is applied to the table, the table's selection mode is automatically set to MultiToggle and cannot be changed.


Constructor

Constructs an instance of sap.ui.table.plugins.MultiSelectionPlugin

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.table.plugins.MultiSelectionPlugin()

Properties

Name Type Default Value Description
enableNotification boolean false

Enables notifications that are displayed once a selection has been limited.

Since: 1.71.

Visibility: public
limit int 200

Number of indices which can be selected in a range. Accepts positive integer values. If set to 0, the limit is disabled, and the Select All checkbox appears instead of the Deselect All button. Note: To avoid severe performance problems, the limit should only be set to 0 in the following cases:

  • With client-side models
  • With server-side models if they are used in client mode
  • If the entity set is small
In other cases, we recommend to set the limit to at least double the value of the threshold property of the related sap.ui.table.Table control.

Visibility: public
selectionMode sap.ui.table.SelectionMode MultiToggle

Selection mode of the plugin. This property controls whether single or multiple rows can be selected. It also influences the visual appearance. When the selection mode is changed, the current selection is removed.

Visibility: public
showHeaderSelector boolean true

Show header selector

Visibility: public

Events Overview

Event Description
selectionChange

This event is fired when the selection is changed.

selectionChange

This event is fired when the selection is changed.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
indices int[]

Array of indices whose selection has been changed (either selected or deselected)

limitReached boolean

Indicates whether the selection limit has been reached

customPayload object

Contains the data passed to the function that triggered the event


Methods Overview

Method Description
addSelectionInterval

Adds the given selection interval to the selection and requests the corresponding binding contexts. In single-selection mode it requests the context and sets the selected index to iIndexTo.

If the number of indices in the range is greater than the value of the limit property, only n=limit indices, starting from iIndexFrom, are selected. The table is scrolled to display the index last selected.

attachSelectionChange

Attaches event handler fnFunction to the selectionChange event of this sap.ui.table.plugins.MultiSelectionPlugin.

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.table.plugins.MultiSelectionPlugin itself.

This event is fired when the selection is changed.

clearSelection

Removes the complete selection.

detachSelectionChange

Detaches event handler fnFunction from the selectionChange event of this sap.ui.table.plugins.MultiSelectionPlugin.

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

sap.ui.table.plugins.MultiSelectionPlugin.extend

Creates a new subclass of class sap.ui.table.plugins.MultiSelectionPlugin 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.table.plugins.SelectionPlugin.extend.

fireSelectionChange

Fires event selectionChange to attached listeners.

getEnableNotification

Gets current value of property enableNotification.

Enables notifications that are displayed once a selection has been limited.

Default value is false.

getLimit

Gets current value of property limit.

Number of indices which can be selected in a range. Accepts positive integer values. If set to 0, the limit is disabled, and the Select All checkbox appears instead of the Deselect All button. Note: To avoid severe performance problems, the limit should only be set to 0 in the following cases:

  • With client-side models
  • With server-side models if they are used in client mode
  • If the entity set is small
In other cases, we recommend to set the limit to at least double the value of the threshold property of the related sap.ui.table.Table control.

Default value is 200.

sap.ui.table.plugins.MultiSelectionPlugin.getMetadata

Returns a metadata object for class sap.ui.table.plugins.MultiSelectionPlugin.

getSelectedIndices

Zero-based indices of selected indices, wrapped in an array. An empty array means nothing has been selected.

getSelectionMode

Gets current value of property selectionMode.

Selection mode of the plugin. This property controls whether single or multiple rows can be selected. It also influences the visual appearance. When the selection mode is changed, the current selection is removed.

Default value is MultiToggle.

getShowHeaderSelector

Gets current value of property showHeaderSelector.

Show header selector

Default value is true.

isIndexSelected

Returns the information whether the given index is selected.

removeSelectionInterval

Removes the given selection interval from the selection. In case of single selection, only iIndexTo is removed from the selection.

selectAll

Requests the binding contexts and adds all indices to the selection if the limit is disabled or the binding length is smaller then the limit.

setEnableNotification

Sets a new value for property enableNotification.

Enables notifications that are displayed once a selection has been limited.

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

Default value is false.

setLimit

Sets a new value for property limit.

Number of indices which can be selected in a range. Accepts positive integer values. If set to 0, the limit is disabled, and the Select All checkbox appears instead of the Deselect All button. Note: To avoid severe performance problems, the limit should only be set to 0 in the following cases:

  • With client-side models
  • With server-side models if they are used in client mode
  • If the entity set is small
In other cases, we recommend to set the limit to at least double the value of the threshold property of the related sap.ui.table.Table control.

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

Default value is 200.

setSelectedIndex

Requests the context and sets the selected index to iIndex.

setSelectionInterval

Sets the given selection interval as the selection and requests the corresponding binding contexts. In single-selection mode it requests the context and sets the selected index to iIndexTo.

If the number of indices in the range is greater than the value of the limit property, only n=limit indices, starting from iIndexFrom, are selected. The table is scrolled to display the index last selected.

setSelectionMode

Sets a new value for property selectionMode.

Selection mode of the plugin. This property controls whether single or multiple rows can be selected. It also influences the visual appearance. When the selection mode is changed, the current selection is removed.

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

Default value is MultiToggle.

setShowHeaderSelector

Sets a new value for property showHeaderSelector.

Show header selector

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

Default value is true.

addSelectionInterval

Adds the given selection interval to the selection and requests the corresponding binding contexts. In single-selection mode it requests the context and sets the selected index to iIndexTo.

If the number of indices in the range is greater than the value of the limit property, only n=limit indices, starting from iIndexFrom, are selected. The table is scrolled to display the index last selected.

Param Type DefaultValue Description
iIndexFrom int

Index from which the selection starts

iIndexTo int

Index up to which to select

oEventPayload object

If the function call triggers a selectionChange event, this object is transferred to the event in the customPayload parameter

attachSelectionChange

Attaches event handler fnFunction to the selectionChange event of this sap.ui.table.plugins.MultiSelectionPlugin.

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.table.plugins.MultiSelectionPlugin itself.

This event is fired when the selection is 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.table.plugins.MultiSelectionPlugin itself

clearSelection

Removes the complete selection.

Param Type DefaultValue Description
oEventPayload object

If the function call triggers a selectionChange event, this object is transferred to the event in the customPayload parameter

detachSelectionChange

Detaches event handler fnFunction from the selectionChange event of this sap.ui.table.plugins.MultiSelectionPlugin.

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.table.plugins.MultiSelectionPlugin.extend

Creates a new subclass of class sap.ui.table.plugins.MultiSelectionPlugin 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.table.plugins.SelectionPlugin.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

fireSelectionChange

Fires event selectionChange to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

indices int[]

Array of indices whose selection has been changed (either selected or deselected)

limitReached boolean

Indicates whether the selection limit has been reached

customPayload object

Contains the data passed to the function that triggered the event

getEnableNotification

Gets current value of property enableNotification.

Enables notifications that are displayed once a selection has been limited.

Default value is false.

getLimit

Gets current value of property limit.

Number of indices which can be selected in a range. Accepts positive integer values. If set to 0, the limit is disabled, and the Select All checkbox appears instead of the Deselect All button. Note: To avoid severe performance problems, the limit should only be set to 0 in the following cases:

In other cases, we recommend to set the limit to at least double the value of the threshold property of the related sap.ui.table.Table control.

Default value is 200.

sap.ui.table.plugins.MultiSelectionPlugin.getMetadata

Returns a metadata object for class sap.ui.table.plugins.MultiSelectionPlugin.

getSelectedIndices

Zero-based indices of selected indices, wrapped in an array. An empty array means nothing has been selected.

getSelectionMode

Gets current value of property selectionMode.

Selection mode of the plugin. This property controls whether single or multiple rows can be selected. It also influences the visual appearance. When the selection mode is changed, the current selection is removed.

Default value is MultiToggle.

getShowHeaderSelector

Gets current value of property showHeaderSelector.

Show header selector

Default value is true.

isIndexSelected

Returns the information whether the given index is selected.

Param Type DefaultValue Description
iIndex int

The index for which the selection state is retrieved

removeSelectionInterval

Removes the given selection interval from the selection. In case of single selection, only iIndexTo is removed from the selection.

Param Type DefaultValue Description
iIndexFrom int

Index from which the deselection starts

iIndexTo int

Index up to which to deselect

oEventPayload object

If the function call triggers a selectionChange event, this object is transferred to the event in the customPayload parameter

selectAll

Requests the binding contexts and adds all indices to the selection if the limit is disabled or the binding length is smaller then the limit.

Param Type DefaultValue Description
oEventPayload object

If the function call triggers a selectionChange event, this object is transferred to the event in the customPayload parameter

setEnableNotification

Sets a new value for property enableNotification.

Enables notifications that are displayed once a selection has been limited.

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

New value for property enableNotification

setLimit

Sets a new value for property limit.

Number of indices which can be selected in a range. Accepts positive integer values. If set to 0, the limit is disabled, and the Select All checkbox appears instead of the Deselect All button. Note: To avoid severe performance problems, the limit should only be set to 0 in the following cases:

In other cases, we recommend to set the limit to at least double the value of the threshold property of the related sap.ui.table.Table control.

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

Default value is 200.

Param Type DefaultValue Description
iLimit int 200

New value for property limit

setSelectedIndex

Requests the context and sets the selected index to iIndex.

Param Type DefaultValue Description
iIndex int

The index to select

oEventPayload object

If the function call triggers a selectionChange event, this object is transferred to the event in the customPayload parameter

setSelectionInterval

Sets the given selection interval as the selection and requests the corresponding binding contexts. In single-selection mode it requests the context and sets the selected index to iIndexTo.

If the number of indices in the range is greater than the value of the limit property, only n=limit indices, starting from iIndexFrom, are selected. The table is scrolled to display the index last selected.

Param Type DefaultValue Description
iIndexFrom int

Index from which the selection starts

iIndexTo int

Index up to which to select

oEventPayload object

If the function call triggers a selectionChange event, this object is transferred to the event in the customPayload parameter

setSelectionMode

Sets a new value for property selectionMode.

Selection mode of the plugin. This property controls whether single or multiple rows can be selected. It also influences the visual appearance. When the selection mode is changed, the current selection is removed.

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

Default value is MultiToggle.

Param Type DefaultValue Description
sSelectionMode sap.ui.table.SelectionMode MultiToggle

New value for property selectionMode

setShowHeaderSelector

Sets a new value for property showHeaderSelector.

Show header selector

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
bShowHeaderSelector boolean true

New value for property showHeaderSelector