cancel
Showing results for 
Search instead for 
Did you mean: 

How to do a break line in the title of a Dialog UI5

0 Kudos
1,416

Hi,

I have the next Dialog in UI5:

but as you can see it dont shows the entire title, so I want to do a break line in order to show the title in 2 lines and don't have to make widther the dialog. Is it possible?

here is my code for the Dialog:

oDialog = new Dialog({
title: "Are you sure you want to delete  "+var1+" from the .... "+
var2+"?" });
View Entire Topic
pfefferf
Active Contributor

The sap.m.Dialog control uses internally a sap.m.Title to display the title. Although sap.m.Title does provide a wrapping property, this cannot be used by default with the sap.m.Dialog control, because the Title control is not accessible (at least not in a "legal" way, without breaking the interface contracts).

But you can set a customHeader for your dialog, e.g. like following:

const dialog = new Dialog();
const bar = new Toolbar();
const title = new Title({ text: "This is my crazy long text which does not fit on one line", wrapping: true });
bar.addContent(title);
dialog.setCustomHeader(bar);

With that you set a customer header which is a toolbar including a title control enabled for wrapping.

It looks like following then (can be optimized by e.g. the wrappingType available on the title control):

0 Kudos

It worked !

Thank you!