Skip to content

Class: ActionBarItemProxy

ActionBarProxy is a developer-facing class that provides access to an actionbar item control for application specific customizations.

example

export default function UpdateActionBarItem(context) {
  // Get a specific actionbar item by name
  const pageProxy = context.getPageProxy();
  const actionBarProxy = pageProxy.getActionBar();
  const saveButton = actionBarProxy.getItem('SaveButton');

  if (saveButton) {
    // Modify multiple properties
    saveButton.setCaption('Update');
    saveButton.setIcon('sap-icon://save');
    saveButton.setVisible(true); // Calling method inherited from ControlProxy
    saveButton.setEnabled(true);
  }
}

Hierarchy

Implements

Summary

Constructors

Properties

Class Properties

Currently none in this class.

Inherited Properties

Accessors

Class Accessors

Currently none in this class.

Inherited Accessors

Methods

Class Methods

Inherited Methods

Constructors

constructor

+ new ActionBarItemProxy(context: IContext): ActionBarItemProxy

Inherited from ControlProxy.constructor

Overrides ClientAPI.constructor

Parameters:

Name Type
context IContext

Returns: ActionBarItemProxy

Methods

getCaption

getCaption(): string

Implementation of IActionBarItemProxy

Overrides ControlProxy.getCaption

Returns the Caption property value defined for the control.

example

// Get current caption of actionbar item
const actionBarItem = actionBarProxy.getItem('SaveButton');
const currentCaption = actionBarItem.getCaption();
console.log('Button caption:', currentCaption);

Returns: string


getEnabled

getEnabled(): boolean

Implementation of IActionBarItemProxy

Returns the Enabled property value defined for the control.

example

// Check if an actionbar item is enabled
const actionBarItem = actionBarProxy.getItem('SaveButton');
const isEnabled = actionBarItem.getEnabled();
console.log('Save button enabled:', isEnabled);

Returns: boolean


getIcon

getIcon(): string

Implementation of IActionBarItemProxy

Returns the Icon property value defined for the control.

example

// Get current icon of actionbar item
const actionBarItem = actionBarProxy.getItem('IconButton');
const currentIcon = actionBarItem.getIcon();
console.log('Current icon:', currentIcon);

Returns: string


getIconText

getIconText(): string

Implementation of IActionBarItemProxy

Returns the IconText property value defined for the control.

example

// Get current icon text of actionbar item
const actionBarItem = actionBarProxy.getItem('IconTextButton');
const iconText = actionBarItem.getIconText();
console.log('Icon text:', iconText);

Returns: string


getIsIconCircular

getIsIconCircular(): boolean

Implementation of IActionBarItemProxy

Returns the IsIconCircular property value defined for the control.

example

// Check if actionbar item icon is circular
const actionBarItem = actionBarProxy.getItem('IconButton');
const isCircular = actionBarItem.getIsIconCircular();
console.log('Icon is circular:', isCircular);

Returns: boolean


getPageProxy

getPageProxy(): IPageProxy

Implementation of IActionBarItemProxy

Overrides ControlProxy.getPageProxy

Gets the page that contains this actionbar item's parent actionbar.

example

// Get the page proxy from an actionbar item
const pageProxy = actionBarItem.getPageProxy();

// Use page proxy to access other controls on the page
const sectionedTable = pageProxy.getControl('CustomerTable');
if (sectionedTable) {
  sectionedTable.redraw();
}

**Returns:** *[IPageProxy](../interfaces/ipageproxy.md)*

the page, which the element belongs to

___

###  getParent

 **getParent**(): *[IActionBarProxy](../interfaces/iactionbarproxy.md)*

*Implementation of [IActionBarItemProxy](../interfaces/iactionbaritemproxy.md)*

*Overrides [ControlProxy](controlproxy.md).[getParent](controlproxy.md#getparent)*



Gets the parent actionbar control that contains this actionbar item.

**`example`** 
```javascript
// Get the parent actionbar proxy from an actionbar item
const parentActionBarProxy = actionBarItem.getParent();

// Use parent to access other actionbar properties or items
parentActionBarProxy.setCaption('Updated Title');
const otherItem = parentActionBarProxy.getItem('CancelButton');

Returns: IActionBarProxy

The control of the actionbar container that contains this item


getPosition

getPosition(): string

Implementation of IActionBarItemProxy

Returns the Position property value defined for the control.

example

// Get current position of actionbar item
const actionBarItem = actionBarProxy.getItem('SaveButton');
const position = actionBarItem.getPosition();
console.log('Button position:', position);

Returns: string


getStyle

getStyle(): any

Implementation of IActionBarItemProxy

Returns the Style property value defined for the control.

example

// Get current style of actionbar item
const actionBarItem = actionBarProxy.getItem('SaveButton');
const currentStyle = actionBarItem.getStyle();
console.log('Current style:', currentStyle);

Returns: any


getSystemItem

getSystemItem(): string

Implementation of IActionBarItemProxy

Returns the SystemItem property value defined for the control.

example

// Get current system item of actionbar item
const actionBarItem = actionBarProxy.getItem('ActionButton');
const systemItem = actionBarItem.getSystemItem();
console.log('System item:', systemItem);

Returns: string


getVisible

getVisible(): boolean

Implementation of IActionBarItemProxy

Gets the control's visible state.

example

// Check if an actionbar item is visible
const actionBarItem = actionBarProxy.getItem('SaveButton');
const isVisible = actionBarItem.getVisible();
console.log('Save button visible:', isVisible);

Returns: boolean

returns true if the control is visible otherwise false.


reset

reset(): Promise‹any›

Implementation of IActionBarItemProxy

Reset ActionBar item to its original (metadata-defined) state. It is then redrawn to reflect the reset state.

example

// Modify an item at runtime
const actionBarItem = actionBarProxy.getItem('SaveButton');
actionBarItem.setCaption('Draft');
actionBarItem.setIcon('sap-icon://edit');
actionBarItem.setEnabled(false);
actionBarItem.setVisible(true);

// Revert all runtime changes back to metadata
return actionBarItem.reset().then(() => {
  // Item now reflects its original metadata-defined properties
  console.log('Action bar item restored to metadata state');
});

Returns: Promise‹any›


setCaption

setCaption(caption: string): void

Implementation of IActionBarItemProxy

Sets the Caption property of the control.

example

// Update actionbar item caption
const actionBarItem = actionBarProxy.getItem('SaveButton');
actionBarItem.setCaption('Update'); // Change from 'Save' to 'Update'

Parameters:

Name Type Description
caption string value to set.

Returns: void


setEnabled

setEnabled(isEnabled: boolean): void

Implementation of IActionBarItemProxy

Sets the Enabled property of the control.

example

// Enable or disable an actionbar item
const actionBarItem = actionBarProxy.getItem('SaveButton');
actionBarItem.setEnabled(false); // Disable the button

// Get current enabled state and toggle it
const currentState = actionBarItem.getEnabled();
actionBarItem.setEnabled(!currentState);

Parameters:

Name Type Description
isEnabled boolean true enables and false disables.

Returns: void


setIcon

setIcon(icon: string): void

Implementation of IActionBarItemProxy

Sets the Icon property of the control.

example

// Set icon for actionbar item
const actionBarItem = actionBarProxy.getItem('IconButton');
actionBarItem.setIcon('sap-icon://home'); // Set SAP icon

// Or use a custom image path
actionBarItem.setIcon('/MDKDevApp/Images/profile.png');

Parameters:

Name Type Description
icon string value to set.

Returns: void


setIconText

setIconText(iconText: string): void

Implementation of IActionBarItemProxy

Sets the IconText property of the control.

example

// Set icon text for actionbar item
const actionBarItem = actionBarProxy.getItem('IconTextButton');
actionBarItem.setIconText('AB'); // Short text representation

Parameters:

Name Type Description
iconText string value to set.

Returns: void


setIsIconCircular

setIsIconCircular(isIconCircular: boolean): void

Implementation of IActionBarItemProxy

Sets the IsIconCircular property of the control.

example

// Make actionbar item icon circular
const actionBarItem = actionBarProxy.getItem('IconButton');
actionBarItem.setIsIconCircular(true);

Parameters:

Name Type Description
isIconCircular boolean value to set.

Returns: void


setPosition

setPosition(position: string): void

Implementation of IActionBarItemProxy

Sets the Position property of the control.

example

// Set actionbar item position
const actionBarItem = actionBarProxy.getItem('SaveButton');
actionBarItem.setPosition('Right');

Parameters:

Name Type Description
position string value to set.

Returns: void


setSystemItem

setSystemItem(systemItem: string): void

Implementation of IActionBarItemProxy

Sets the SystemItem property of the control.

example

// Set system item for actionbar item
const actionBarItem = actionBarProxy.getItem('ActionButton');
actionBarItem.setSystemItem('Camera'); // Change to camera icon

Parameters:

Name Type Description
systemItem string value to set.

Returns: void