Class sap.ui.comp.variants.VariantManagementModule: sap/ui/comp/variants/VariantManagement

extends Control

The VariantManagement control can be used to manage variants, such as filter bar variants or table variants.

Constructor Summary
new sap.ui.comp.variants.VariantManagement(sId?, mSettings?)Constructor for a new VariantManagement.
Event Summary
manage(oControlEvent)This event is fired when users apply changes to variants in the Manage Variants dialog.
save(oControlEvent)This event is fired when the Save Variant dialog is closed with OK for a variant.
select(oControlEvent)This event is fired when a new variant is selected.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.comp.variants.VariantManagement.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.comp.variants.VariantManagement with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.comp.variants.VariantManagement.getMetadata()Returns a metadata object for class sap.ui.comp.variants.VariantManagement.
addVariantItem(oVariantItem)Adds some variantItem to the aggregation variantItems.
attachManage(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the manage event of this sap.ui.comp.variants.VariantManagement.
attachSave(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the save event of this sap.ui.comp.variants.VariantManagement.
attachSelect(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the select event of this sap.ui.comp.variants.VariantManagement.
clearVariantSelection()Removes the current variant selection and resets to default value.
destroyVariantItems()Destroys all the variantItems in the aggregation variantItems.
detachManage(fnFunction, oListener)Detaches event handler fnFunction from the manage event of this sap.ui.comp.variants.VariantManagement.
detachSave(fnFunction, oListener)Detaches event handler fnFunction from the save event of this sap.ui.comp.variants.VariantManagement.
detachSelect(fnFunction, oListener)Detaches event handler fnFunction from the select event of this sap.ui.comp.variants.VariantManagement.
fireManage(mArguments?)Fires event manage to attached listeners.
fireSave(mArguments?)Fires event save to attached listeners.
fireSelect(mArguments?)Fires event select to attached listeners.
getDefaultVariantKey()Gets current value of property defaultVariantKey.
getEnabled()Gets current value of property enabled.
getIndustrySolutionMode()Gets current value of property industrySolutionMode.
getInitialSelectionKey()Gets current value of property initialSelectionKey.
getLifecycleSupport()Gets current value of property lifecycleSupport.
getSelectionKey()Gets current value of property selectionKey.
getShowExecuteOnSelection()Gets current value of property showExecuteOnSelection.
getShowShare()Gets current value of property showShare.
getStandardItemText()Gets current value of property standardItemText.
getVariantItems()Gets content of aggregation variantItems.
indexOfVariantItem(oVariantItem)Checks for the provided sap.ui.comp.variants.VariantItem in the aggregation variantItems.
insertVariantItem(oVariantItem, iIndex)Inserts a variantItem into the aggregation variantItems.
removeAllVariantItems()Removes all the controls from the aggregation variantItems.
removeVariantItem(vVariantItem)Removes a variantItem from the aggregation variantItems.
setDefaultVariantKey(sDefaultVariantKey)Sets a new value for property defaultVariantKey.
setEnabled(bEnabled)Sets a new value for property enabled.
setIndustrySolutionMode(bIndustrySolutionMode)Sets a new value for property industrySolutionMode.
setInitialSelectionKey(sInitialSelectionKey)Sets a new value for property initialSelectionKey.
setLifecycleSupport(bLifecycleSupport)Sets a new value for property lifecycleSupport.
setSelectionKey(sSelectionKey)Sets a new value for property selectionKey.
setShowExecuteOnSelection(bShowExecuteOnSelection)Sets a new value for property showExecuteOnSelection.
setShowShare(bShowShare)Sets a new value for property showShare.
setStandardItemText(sStandardItemText)Sets a new value for property standardItemText.
addItem(oItem)Adds some item to the aggregation items.
destroyItems()Destroys all the items in the aggregation items.
getItems()Gets content of aggregation items.
getShowCreateTile()Gets current value of property showCreateTile.
indexOfItem(oItem)Checks for the provided sap.ui.core.Item in the aggregation items.
insertItem(oItem, iIndex)Inserts a item into the aggregation items.
removeAllItems()Removes all the controls from the aggregation items.
removeItem(vItem)Removes a item from the aggregation items.
setShowCreateTile(bShowCreateTile)Sets a new value for property showCreateTile.
Constructor Detail
new sap.ui.comp.variants.VariantManagement(sId?, mSettings?)
Constructor for a new VariantManagement.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.

The supported settings are:

In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.

Parameters:
{string}sId? ID for the new control, generated automatically if no ID is given
{object}mSettings? Initial settings for the new control
Event Detail
manage(oControlEvent)
This event is fired when users apply changes to variants in the Manage Variants dialog.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string[]}oControlEvent.getParameters.renamed List of changed variant keys
{string[]}oControlEvent.getParameters.deleted List of deleted variant keys
{object[]}oControlEvent.getParameters.exe List of variant keys and the associated Execute on Selection indicator
{boolean}oControlEvent.getParameters.def The default variant key
Since:
1.22.0
save(oControlEvent)
This event is fired when the Save Variant dialog is closed with OK for a variant.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.name The variant title
{boolean}oControlEvent.getParameters.overwrite Indicates if an existing variant is overwritten or if a new variant is created
{string}oControlEvent.getParameters.key The variant key
{boolean}oControlEvent.getParameters.exe The Execute on Selection indicator
{boolean}oControlEvent.getParameters.def The default variant indicator
{boolean}oControlEvent.getParameters.global The shared variant indicator
{string}oControlEvent.getParameters.lifecyclePackage The package name
{string}oControlEvent.getParameters.lifecycleTransportId The transport ID
Since:
1.22.0
select(oControlEvent)
This event is fired when a new variant is selected.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.key The variant key
Since:
1.22.0
Method Detail
sap.ui.comp.variants.VariantManagement.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.comp.variants.VariantManagement 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.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.comp.variants.VariantManagement.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.comp.variants.VariantManagement.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addVariantItem(oVariantItem): sap.ui.comp.variants.VariantManagement
Adds some variantItem to the aggregation variantItems.
Parameters:
{sap.ui.comp.variants.VariantItem}oVariantItem the variantItem to add; if empty, nothing is inserted
Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
attachManage(oData?, fnFunction, oListener?): sap.ui.comp.variants.VariantManagement
Attaches event handler fnFunction to the manage event of this sap.ui.comp.variants.VariantManagement.

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.comp.variants.VariantManagement itself.

This event is fired when users apply changes to variants in the Manage Variants dialog.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.comp.variants.VariantManagement itself
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
attachSave(oData?, fnFunction, oListener?): sap.ui.comp.variants.VariantManagement
Attaches event handler fnFunction to the save event of this sap.ui.comp.variants.VariantManagement.

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.comp.variants.VariantManagement itself.

This event is fired when the Save Variant dialog is closed with OK for a variant.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.comp.variants.VariantManagement itself
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
attachSelect(oData?, fnFunction, oListener?): sap.ui.comp.variants.VariantManagement
Attaches event handler fnFunction to the select event of this sap.ui.comp.variants.VariantManagement.

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.comp.variants.VariantManagement itself.

This event is fired when a new variant is selected.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.comp.variants.VariantManagement itself
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
clearVariantSelection()
Removes the current variant selection and resets to default value.
Since:
1.22.0
Destroys all the variantItems in the aggregation variantItems.
Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
detachManage(fnFunction, oListener): sap.ui.comp.variants.VariantManagement
Detaches event handler fnFunction from the manage event of this sap.ui.comp.variants.VariantManagement.

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

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
detachSave(fnFunction, oListener): sap.ui.comp.variants.VariantManagement
Detaches event handler fnFunction from the save event of this sap.ui.comp.variants.VariantManagement.

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

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
detachSelect(fnFunction, oListener): sap.ui.comp.variants.VariantManagement
Detaches event handler fnFunction from the select event of this sap.ui.comp.variants.VariantManagement.

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

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
fireManage(mArguments?): sap.ui.comp.variants.VariantManagement
Fires event manage to attached listeners.

Expects the following event parameters:

  • renamed of type string[]List of changed variant keys
  • deleted of type string[]List of deleted variant keys
  • exe of type object[]List of variant keys and the associated Execute on Selection indicator
  • def of type booleanThe default variant key
Parameters:
{Map}mArguments? The arguments to pass along with the event
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
Fires event save to attached listeners.

Expects the following event parameters:

  • name of type stringThe variant title
  • overwrite of type booleanIndicates if an existing variant is overwritten or if a new variant is created
  • key of type stringThe variant key
  • exe of type booleanThe Execute on Selection indicator
  • def of type booleanThe default variant indicator
  • global of type booleanThe shared variant indicator
  • lifecyclePackage of type stringThe package name
  • lifecycleTransportId of type stringThe transport ID
Parameters:
{Map}mArguments? The arguments to pass along with the event
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
fireSelect(mArguments?): sap.ui.comp.variants.VariantManagement
Fires event select to attached listeners.

Expects the following event parameters:

  • key of type stringThe variant key
Parameters:
{Map}mArguments? The arguments to pass along with the event
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
getDefaultVariantKey(): string
Gets current value of property defaultVariantKey.

Provides a string value to set the default variant. Used for the save dialog. Has no effect on the selected variant.

Since:
1.22.0
Returns:
{string} Value of property defaultVariantKey
getEnabled(): boolean
Gets current value of property enabled.

Can be set to true or false depending on whether you want to enable or disable the control.

Default value is true.

Since:
1.22.0
Returns:
{boolean} Value of property enabled
getIndustrySolutionMode(): boolean
Gets current value of property industrySolutionMode.

If set totrue, the scenario is an industry-specific solution. This flag is only used internally in the app variant scenarios.

Default value is false.

Since:
1.32.0
Returns:
{boolean} Value of property industrySolutionMode
getInitialSelectionKey(): string
Gets current value of property initialSelectionKey.

Enables the setting of the initially selected variant.

Since:
1.22.0
Returns:
{string} Value of property initialSelectionKey
getLifecycleSupport(): boolean
Gets current value of property lifecycleSupport.

Enables the lifecycle support. If set to true, the VariantManagement control handles the transport information for shared variants.

Default value is false.

Since:
1.26.0
Returns:
{boolean} Value of property lifecycleSupport
getSelectionKey(): string
Gets current value of property selectionKey.

The key of the currently selected item. Returns null if the default item list is selected.

Since:
1.24.0
Returns:
{string} Value of property selectionKey
getShowExecuteOnSelection(): boolean
Gets current value of property showExecuteOnSelection.

Indicates that Execute on Selection is visible in the Save Variant and the Manage Variants dialogs.

Default value is false.

Since:
1.26.0
Returns:
{boolean} Value of property showExecuteOnSelection
getShowShare(): boolean
Gets current value of property showShare.

Indicates that Share is visible in the Save Variant and the Manage Variants dialogs. Share allows you to share variants with other users.

Default value is false.

Since:
1.26.0
Returns:
{boolean} Value of property showShare
getStandardItemText(): string
Gets current value of property standardItemText.

Overwrites the default Standard variant title.

Since:
1.28.0
Returns:
{string} Value of property standardItemText
getVariantItems(): sap.ui.comp.variants.VariantItem[]
Gets content of aggregation variantItems.

Variant items displayed by the VariantManagement control.

Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantItem[]}
indexOfVariantItem(oVariantItem): int
Checks for the provided sap.ui.comp.variants.VariantItem in the aggregation variantItems. and returns its index if found or -1 otherwise.
Parameters:
{sap.ui.comp.variants.VariantItem}oVariantItem The variantItem whose index is looked for
Since:
1.26.0
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertVariantItem(oVariantItem, iIndex): sap.ui.comp.variants.VariantManagement
Inserts a variantItem into the aggregation variantItems.
Parameters:
{sap.ui.comp.variants.VariantItem}oVariantItem the variantItem to insert; if empty, nothing is inserted
{int}iIndex the 0-based index the variantItem should be inserted at; for a negative value of iIndex, the variantItem is inserted at position 0; for a value greater than the current size of the aggregation, the variantItem is inserted at the last position
Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
removeAllVariantItems(): sap.ui.comp.variants.VariantItem[]
Removes all the controls from the aggregation variantItems.

Additionally, it unregisters them from the hosting UIArea.

Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantItem[]} An array of the removed elements (might be empty)
removeVariantItem(vVariantItem): sap.ui.comp.variants.VariantItem
Removes a variantItem from the aggregation variantItems.
Parameters:
{int|string|sap.ui.comp.variants.VariantItem}vVariantItem The variantItemto remove or its index or id
Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantItem} The removed variantItem or null
setDefaultVariantKey(sDefaultVariantKey): sap.ui.comp.variants.VariantManagement
Sets a new value for property defaultVariantKey.

Provides a string value to set the default variant. Used for the save dialog. Has no effect on the selected variant.

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

Parameters:
{string}sDefaultVariantKey New value for property defaultVariantKey
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
Sets a new value for property enabled.

Can be set to true or false depending on whether you want to enable or disable the control.

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

Default value is true.

Parameters:
{boolean}bEnabled New value for property enabled
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
setIndustrySolutionMode(bIndustrySolutionMode): sap.ui.comp.variants.VariantManagement
Sets a new value for property industrySolutionMode.

If set totrue, the scenario is an industry-specific solution. This flag is only used internally in the app variant scenarios.

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

Default value is false.

Parameters:
{boolean}bIndustrySolutionMode New value for property industrySolutionMode
Since:
1.32.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
setInitialSelectionKey(sInitialSelectionKey): sap.ui.comp.variants.VariantManagement
Sets a new value for property initialSelectionKey.

Enables the setting of the initially selected variant.

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

Parameters:
{string}sInitialSelectionKey New value for property initialSelectionKey
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
setLifecycleSupport(bLifecycleSupport): sap.ui.comp.variants.VariantManagement
Sets a new value for property lifecycleSupport.

Enables the lifecycle support. If set to true, the VariantManagement control handles the transport information for shared variants.

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

Default value is false.

Parameters:
{boolean}bLifecycleSupport New value for property lifecycleSupport
Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
setSelectionKey(sSelectionKey): sap.ui.comp.variants.VariantManagement
Sets a new value for property selectionKey.

The key of the currently selected item. Returns null if the default item list is selected.

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

Parameters:
{string}sSelectionKey New value for property selectionKey
Since:
1.24.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
setShowExecuteOnSelection(bShowExecuteOnSelection): sap.ui.comp.variants.VariantManagement
Sets a new value for property showExecuteOnSelection.

Indicates that Execute on Selection is visible in the Save Variant and the Manage Variants dialogs.

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

Default value is false.

Parameters:
{boolean}bShowExecuteOnSelection New value for property showExecuteOnSelection
Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
setShowShare(bShowShare): sap.ui.comp.variants.VariantManagement
Sets a new value for property showShare.

Indicates that Share is visible in the Save Variant and the Manage Variants dialogs. Share allows you to share variants with other users.

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

Default value is false.

Parameters:
{boolean}bShowShare New value for property showShare
Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
setStandardItemText(sStandardItemText): sap.ui.comp.variants.VariantManagement
Sets a new value for property standardItemText.

Overwrites the default Standard variant title.

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

Parameters:
{string}sStandardItemText New value for property standardItemText
Since:
1.28.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
Adds some item to the aggregation items.
Parameters:
{sap.ui.core.Item}oItem the item to add; if empty, nothing is inserted
Deprecated:
Since version 1.26.0. Replaced by association variantItems
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
Destroys all the items in the aggregation items.
Deprecated:
Since version 1.26.0. Replaced by association variantItems
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
getItems(): sap.ui.core.Item[]
Gets content of aggregation items.

Items displayed by the VariantManagement control.

Deprecated:
Since version 1.26.0. Replaced by association variantItems
Since:
1.22.0
Returns:
{sap.ui.core.Item[]}
getShowCreateTile(): boolean
Gets current value of property showCreateTile.

Indicates that a Create Tile is visible in the Create dialog.

Default value is false.

Deprecated:
Since version 1.32.0.
Since:
1.26.0
Returns:
{boolean} Value of property showCreateTile
indexOfItem(oItem): int
Checks for the provided sap.ui.core.Item in the aggregation items. and returns its index if found or -1 otherwise.
Parameters:
{sap.ui.core.Item}oItem The item whose index is looked for
Deprecated:
Since version 1.26.0. Replaced by association variantItems
Since:
1.22.0
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertItem(oItem, iIndex): sap.ui.comp.variants.VariantManagement
Inserts a item into the aggregation items.
Parameters:
{sap.ui.core.Item}oItem the item to insert; if empty, nothing is inserted
{int}iIndex 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
Deprecated:
Since version 1.26.0. Replaced by association variantItems
Since:
1.22.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining
removeAllItems(): sap.ui.core.Item[]
Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

Deprecated:
Since version 1.26.0. Replaced by association variantItems
Since:
1.22.0
Returns:
{sap.ui.core.Item[]} An array of the removed elements (might be empty)
removeItem(vItem): sap.ui.core.Item
Removes a item from the aggregation items.
Parameters:
{int|string|sap.ui.core.Item}vItem The itemto remove or its index or id
Deprecated:
Since version 1.26.0. Replaced by association variantItems
Since:
1.22.0
Returns:
{sap.ui.core.Item} The removed item or null
setShowCreateTile(bShowCreateTile): sap.ui.comp.variants.VariantManagement
Sets a new value for property showCreateTile.

Indicates that a Create Tile is visible in the Create dialog.

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

Default value is false.

Parameters:
{boolean}bShowCreateTile New value for property showCreateTile
Deprecated:
Since version 1.32.0.
Since:
1.26.0
Returns:
{sap.ui.comp.variants.VariantManagement} Reference to this in order to allow method chaining