cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Fiori Elemenets Custom Action: Define Icon?

0 Kudos
852

Hello,

I have got an Fiori Elements App based on a Worklist and ObjectPage. I have added some custom Function based on this documentation: Enabling Actions Added Using Extension Points - Documentation - Demo Kit - SAPUI5 SDK (ondemand.com)

This is working as expected. But now I try to add an Icon to the generated Button. Is there any way to achive this? Maybe like:

"MyAction": {"id": "myActionButton","text": "{i18n>myTest}","press": "onActionOne","requiresSelection": true, "icon": "sap-icon://duplicate"},

I'am on a S/4 2022 with SAPUI5 1.108

Thank you for any hint.

ps: I know I would be possible with some hook (onBeforeRendering) or so, but it doesnt feels right 😉


Accepted Solutions (0)

Answers (1)

Answers (1)

AnanyaSingh
Associate
Associate
0 Kudos

Hello,

     To add an icon to your action button in the controller, you can follow this approach:

let moveDownBtnId = this.getView().byId("<pass the button id here>");
const sIconURI_seqDown = IconPool.getIconURI("sap-icon://navigation-down-arrow");
moveDownBtnId.setIcon(sIconURI_seqDown);

This allows you to dynamically set an icon for your action button. You can replace the "sap-icon://navigation-down-arrow" with any other icon URI  that suits your needs.

This method should work without needing to hook into 'onBeforeRendering', and it aligns with your use case in S/4 2022 with SAPUI5 1.108.

Hope this helps!  

Regards,

Ananya