Show TOC

Adding and Removing Custom Items to the Options MenuLocate this document in the navigation structure

Methods of the Renderer API that add an item to, or remove the added item from, the Options menu.

Syntax

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

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

These methods are part of the SAPUI5 sap.ushell.renderers.fiori2 namespace. For more information, see SAPUI5 Demo Kit: Controls 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 bCurrentState 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.