Show TOC

Adding and Removing Custom Items from the Options BarLocate this document in the navigation structure

Use the methods of the Renderer API to add items or remove added items from the options bar in the Me Area.

Syntax

hideActionButton(controlType, oControlProperties, bIsVisible, bCurrentState, aStates)

addActionButton(controlType, oControlProperties, bIsVisible, bCurrentState, aStates)

These methods are part of the SAPUI5 sap.ushell.renderers.fiori2 namespace. For more information, go to SAPUI5 Demo Kit: Controls, and then navigate to Start of the navigation path API REFERENCE Next navigation step sap.ushell.renderers.fiori2 Next navigation step Renderer End of the navigation path.

Parameters
Parameter Type Description
controlType String The class name of the control type to create.
oControlProperties Object The properties that will be passed to the created control.
bIsVisible Boolean

Specifies whether the item is displayed after being created.

If true, The control is displayed according to the bCurrentState and aStates parameters.

If false, the control is created but not displayed.

bCurrentState Boolean If true, the created control is added to the current rendered shell state. When the user navigates to a different state, or to a different application, then the control is removed.

If false, the control is added to the LaunchpadState.

aStates

String

Valid only if bCurrentStateaddActionButton(controlType, oControlProperties, bIsVisible, bCurrentState, aStates) is set to false

A list of the launchpad states in which to add the control.

To determine when the item is displayed, the launchpad state parameters can have the following values of the sap.ushell.renderers.fiori2.Renderer.LaunchpadState enum:
  • Launchpadstate.App: The launchpad state when running a Fiori app.
  • Launchpadstate.Home: The launchpad state when the home page is open.
If no launchpad state is passed, the button is added in all states.
Example
<SCRIPT language ="JavaScript">
   ...
var oRenderer = sap.ushell.Container.getRenderer("fiori2");
oRenderer.addActionButton(
"sap.ushell.ui.custom.myBtton", => the type of the object to add in this case a custom button
{
    id: "hideGroupsBtn" => Property of the object instance to add, the instance is created with this properties object
}, 
 true, => isVIsible
true); => added to the current state and removed when navigation away form it

   ...
<SCRIPT>
Note

You can only remove buttons that were added to the action sheet by the addActionButton method.