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

How to get the Title control within the headerToolbar?

Tula
Product and Topic Expert
Product and Topic Expert
0 Kudos
585

Hi all,

I want to access the Title control within the headerToolbar of a Panel in order to set the title text dynamically. Is there any method already available for that? The Panel and its headerToolbar is as follows:


<Panel>

     <headerToolbar>

          <Toolbar height="2rem">

               <Title id="panelTitle" text="{WorkflowModel>Name}"

               </ToolbarSpacer>

               <Text text="Sequence: {WorkflowModel>Sequence}" />              

               <Button icon="sap-icon://settings" press="onNaviToParameterPressed" tooltip="Go to Parameter Setting"/>

          </Toolbar>

     </headerToolbar>

</Panel>

I tried oPanel.getHeaderToolbar().getContent() and manage to get an array of four control objects (i.e., Title, ToolbarSpacer, Text, Button). However, I think looping through this array to find the Title control is not the optimal way. Therefore, is there any method that can achieve this directly?

Any help would be appreciated.

Regards,

La

View Entire Topic
saivellanki
Active Contributor
0 Kudos

Hi La,

Best way to change the text would be via binding as Jun suggested, since I see the title text is bound - "{WorkflowModel>Name}"


this.getView().getModel("WorkflowModel").setProperty("yourBindingPath", "yourText");

(or) you declared an 'id' for title control.


this.getView().byId("panelTitle").setText("yourText");

Regards,

Sai.