Skip to Content
0
Aug 10, 2016 at 01:42 PM

How to refresh ObjectPageHeader dynamically in SAPUI5?

314 Views

HI,

I need updating all elements of ObjectPageHeader dynamically when I change data in others views. I save the values in global model and when I open the view for the first time the values are displayed correctly, but when I navigate back, change values and return to my view, the values are not refreshed.

My XML code is:

<uxap:ObjectPageLayout id="objPageLayout" showTitleInHeaderContent="true" showHeaderContent="true" showAnchorBar="true"
  subSectionLayout="TitleOnTop">
       <uxap:headerTitle>
            <uxap:ObjectPageHeader id="objHeaderDatosGenerales" objectImageURI="{/personalData/photo}" objectTitle="{/personalData/name}"
                 objectSubtitle="" headerDesign="Light" objectImageShape="Circle" isObjectIconAlwaysVisible="true" isObjectTitleAlwaysVisible="false"
                 isObjectSubtitleAlwaysVisible="false" isActionAreaAlwaysVisible="false"></uxap:ObjectPageHeader>
     </uxap:headerTitle>
     <uxap:headerContent>
          <m:VBox id="__hBoxHeader" displayInline="false" justifyContent="Start" alignItems="Stretch" direction="Column" fitContainer="false" width="auto" renderType="Div" visible="true">
               <m:items>
                    <m:ObjectAttribute id="__attrID" title="ID" text="{/personalData/id}" active="false"/>
                    <m:ObjectAttribute id="__attrName" title="date" text="{/personalData/date}" active="false"/>
               </m:items>
          </m:VBox>
     </uxap:headerContent>
</uxap:ObjectPageLayout>

My JS code is:

handleRouteMatched: function(oEvent) {
     this.getView().setModel(sap.ui.getCore().getModel("MyModel"));
}

I tried to refresh the model, set values manually from model and does not refresh my view.

Many thanks in advance!

Regards,

Juan Lopez