Implements a plugin to enable a special multi-selection behavior:
limit
property by the application. If the user tries to select more indices, the selection is automatically limited, and the table scrolls to the last selected index.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.
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()
Name | Type | Default Value | Description |
---|---|---|---|
enableNotification | boolean | false | Enables notifications that are displayed once a selection has been limited. |
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:
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 |
Event | Description |
---|---|
selectionChange |
This event is fired when the selection is changed. |
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 |
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 If the number of indices in the range is greater than the value of the |
attachSelectionChange |
Attaches event handler When called, the context of the event handler (its This event is fired when the selection is changed. |
clearSelection |
Removes the complete selection. |
detachSelectionChange |
Detaches event handler 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
|
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 |
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:
sap.ui.table.Table control.Default value is |
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 |
getShowHeaderSelector |
Gets current value of property showHeaderSelector. Show header selector Default value is |
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 |
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 Default value is |
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:
sap.ui.table.Table control.When called with a value of Default value is |
setSelectedIndex |
Requests the context and sets the selected index to |
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 If the number of indices in the range is greater than the value of the |
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 Default value is |
setShowHeaderSelector |
Sets a new value for property showHeaderSelector. Show header selector When called with a value of Default value is |
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 |
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 |
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 |
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 |
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 |
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 |
Gets current value of property enableNotification.
Enables notifications that are displayed once a selection has been limited.
Default value is false
.
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:
sap.ui.table.Table
control.Default value is 200
.
Returns a metadata object for class sap.ui.table.plugins.MultiSelectionPlugin.
Zero-based indices of selected indices, wrapped in an array. An empty array means nothing has been selected.
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
.
Gets current value of property showHeaderSelector.
Show header selector
Default value is true
.
Returns the information whether the given index is selected.
Param | Type | DefaultValue | Description |
---|---|---|---|
iIndex | int |
The index for which the selection state is retrieved |
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 |
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 |
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 |
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:
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 |
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 |
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 |
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 |
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 |