Interface: IActionBarItemProxy¶
A designer-facing interface that provides access to an actionbar item control.
It is passed to rules to provide access to an actionbar item control for application specific customizations.
In addition it provides access to the IControlProxy interface.
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¶
-
IActionBarItemProxy
Implemented by¶
Summary¶
Properties¶
Class Properties¶
Currently none in this class.
Inherited Properties¶
Methods¶
Class Methods¶
- getCaption
- getEnabled
- getIcon
- getIconText
- getIsIconCircular
- getPageProxy
- getParent
- getPosition
- getStyle
- getSystemItem
- getVisible
- reset
- setCaption
- setEnabled
- setIcon
- setIconText
- setIsIconCircular
- setPosition
- setSystemItem
Inherited Methods¶
Methods¶
getCaption¶
▸ getCaption(): string
Overrides IControlProxy.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
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
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
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
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
Overrides IControlProxy.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](ipageproxy.md)*
the page, which the element belongs to
___
### getParent
▸ **getParent**(): *[IActionBarProxy](iactionbarproxy.md)*
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
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(): string
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: string
getSystemItem¶
▸ getSystemItem(): string
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
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›
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
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
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
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
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
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
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
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