This artefact is used by the table controls for handling selections. It is not associated with the model layer of UI5.
Method | Description |
---|---|
addSelectionInterval |
Changes the selection to be the union of the current selection and the range between In If this call results in a change to the current selection or lead selection, then a |
attachSelectionChanged |
Attaches event handler When called, the context of the event handler (its |
clearSelection |
Change the selection to the empty set and clears the lead selection. If this call results in a change to the current selection or lead selection, then a |
detachSelectionChanged |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.ui.model.SelectionModel.extend |
Creates a new subclass of class sap.ui.model.SelectionModel with name
|
fireSelectionChanged |
Fires event selectionChanged to attached listeners. Expects following event parameters:
|
getLeadSelectedIndex |
Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval(). |
sap.ui.model.SelectionModel.getMetadata |
Returns a metadata object for class sap.ui.model.SelectionModel. |
getSelectedIndices |
Returns the selected indices as array. |
getSelectionMode |
Returns the current selection mode. |
isSelectedIndex |
Returns true if the specified index is selected. |
moveSelectionInterval |
Moves all selected indices starting at the position This can be used if new items are inserted to the item set and you want to keep the selection. To handle a deletion of items use If this call results in a change to the current selection or lead selection, then a |
removeSelectionInterval |
Changes the selection to be the set difference of the current selection and the indices between If the range of removed selection indices includes the current lead selection, then the lead selection will be unset (set to -1). If this call results in a change to the current selection or lead selection, then a |
selectAll |
Selects all rows up to the If this call results in a change to the current selection, then a |
setSelectionInterval |
Changes the selection to be equal to the range In If this call results in a change to the current selection, then a |
setSelectionMode |
Sets the selection mode. The following list describes the accepted selection modes:
|
sliceSelectionInterval |
Slices a the indices between the two indices from the selection. If If the range of removed selection indices includes the current lead selection, then the lead selection will be unset (set to -1). If this call results in a change to the current selection or lead selection, then a |
Changes the selection to be the union of the current selection and the range between iFromIndex
and iToIndex
inclusive. If iFromIndex
is smaller than iToIndex
, both parameters are swapped.
In SINGLE_SELECTION
selection mode, this is equivalent to calling setSelectionInterval
, and only the second index is used.
If this call results in a change to the current selection or lead selection, then a SelectionChanged
event is fired.
Param | Type | DefaultValue | Description |
---|---|---|---|
iFromIndex | int |
one end of the interval. |
|
iToIndex | int |
other end of the interval |
Attaches event handler fnFunction
to the selectionChanged event of this sap.ui.model.SelectionModel
.
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.model.SelectionModel
itself.
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 |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Change the selection to the empty set and clears the lead selection.
If this call results in a change to the current selection or lead selection, then a SelectionChanged
event is fired.
Detaches event handler fnFunction
from the selectionChanged event of this sap.ui.model.SelectionModel
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
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.model.SelectionModel 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.base.EventProvider.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 selectionChanged to attached listeners.
Expects following event parameters:
int
Lead selection index.int[]
Other selected indices (if available)Param | Type | DefaultValue | Description |
---|---|---|---|
oParameters | object |
Parameters to pass along with the event. |
|
leadIndex | int |
Lead selection index |
|
rowIndices | int[] |
Other selected indices (if available) |
Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
Returns a metadata object for class sap.ui.model.SelectionModel.
Returns true if the specified index is selected.
Param | Type | DefaultValue | Description |
---|---|---|---|
iIndex | int |
Moves all selected indices starting at the position iStartIndex
iMove
items.
This can be used if new items are inserted to the item set and you want to keep the selection. To handle a deletion of items use sliceSelectionInterval
.
If this call results in a change to the current selection or lead selection, then a SelectionChanged
event is fired.
Param | Type | DefaultValue | Description |
---|---|---|---|
iStartIndex | int |
start at this position |
|
iMove | int |
Changes the selection to be the set difference of the current selection and the indices between iFromIndex
and iToIndex
inclusive. If iFromIndex
is smaller than iToIndex
, both parameters are swapped.
If the range of removed selection indices includes the current lead selection, then the lead selection will be unset (set to -1).
If this call results in a change to the current selection or lead selection, then a SelectionChanged
event is fired.
Param | Type | DefaultValue | Description |
---|---|---|---|
iFromIndex | int |
one end of the interval. |
|
iToIndex | int |
other end of the interval |
Selects all rows up to the iToIndex
.
If this call results in a change to the current selection, then a SelectionChanged
event is fired.
Param | Type | DefaultValue | Description |
---|---|---|---|
iToIndex | int |
end of the interval |
Changes the selection to be equal to the range iFromIndex
and iToIndex
inclusive. If iFromIndex
is smaller than iToIndex
, both parameters are swapped.
In SINGLE_SELECTION
selection mode, only iToIndex
is used.
If this call results in a change to the current selection, then a SelectionChanged
event is fired.
Param | Type | DefaultValue | Description |
---|---|---|---|
iFromIndex | int |
one end of the interval. |
|
iToIndex | int |
other end of the interval |
Sets the selection mode. The following list describes the accepted selection modes:
sap.ui.model.SelectionModel.SINGLE_SELECTION
- Only one list index can be selected at a time. In this mode, setSelectionInterval
and addSelectionInterval
are equivalent, both replacing the current selection with the index represented by the second argument (the "lead"). sap.ui.model.SelectionModel.MULTI_SELECTION
- In this mode, there's no restriction on what can be selected. Param | Type | DefaultValue | Description |
---|---|---|---|
iSelectionMode | int |
selection mode |
Slices a the indices between the two indices from the selection. If iFromIndex
is smaller than iToIndex
, both parameters are swapped.
If the range of removed selection indices includes the current lead selection, then the lead selection will be unset (set to -1).
If this call results in a change to the current selection or lead selection, then a SelectionChanged
event is fired.
Param | Type | DefaultValue | Description |
---|---|---|---|
iFromIndex | int |
one end of the interval. |
|
iToIndex | int |
other end of the interval |