Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to manipulate the control sap.m.ObjectHeader

Hello,

I try to move an icon into the Object Header control depending on an odata field. In the XML view you can set the ICON(see screenshot) but it is static. So I'm trying to find an example code how to set it based on odata field value when the form loads. Let's say something is critical so I want to display a "!" Icon.

Anyone who can tell me how to do this and has some sample code?

Thanks

Stefan

Former Member
Former Member replied

Hi Stefan,

try to bind the icon attribute using an formatter:

In Formatter Function:

formatIcon : function(sStatus){

     if(sStatus === 'W'){

          return "sap-icon://warning";

     }

}

In XML View:

<ObjectHeader

          icon="{ path: "<yourODataPath>",

                      formatter: "<nameSpaceForYourFormatter>.formatIcon"

          }"

Regards,

Sascha

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question