cancel
Showing results for 
Search instead for 
Did you mean: 

How to manipulate the control sap.m.ObjectHeader

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks for you help Sascha.