cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Title control within the headerToolbar?

Tula
Advisor
Advisor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

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.

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

do it via binding if possible.  don't access the control to change the attribute if it is bindable