sapui5

How to collapse header in SAPUI5 Object Page by default


how can I display the header in my Object Page collapsed by defaut?

This is how it currently looks:Now And this is how I want it to be: Expected

So far, I only found the option to hide th header content completely. But then I lose the ability to expand it. Is there a way to have the heder collapsed by default while still being able to expand it when needed?

Thanks!


Solution

  • There is no public API to do this. But what you could do is add the following code in the onAfterRendering or onBeforeRendering of your controller:

    this.byId("myObjectPageLayout")._handleDynamicTitlePress();

    Keep in mind that this method is private and your code can break at any moment.