Skip to Content

How to get the Title control within the headerToolbar?

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jul 29, 2016 at 01:29 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 28, 2016 at 02:16 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.