Skip to Content
0

How to add a line break to text property of the TimelineItem control in UI5 XML view?

Nov 07, 2017 at 12:31 AM

369

avatar image

The escape character '\n' and Unicode character \u000a will only work in JavaScript. However, I'm trying to add a line break in XML view as below. But doesn't work.

<code><u:TimelineItem text="First Line\n Second Line"/>

Note \n works as expected for Text control in XML as well.

<code><Text text="First Line\n Second Line"/>
10 |10000 characters needed characters left characters exceeded

Hi Manjunatha,

Write this text (First Line\n Second Line"/) in i18 n file and bind the value in view like below.

in i18n write like below.

propName = First Line\n Second Line

It will work.

<code><Texttext="{i18n>propName}"/>

Regards

Shekar.

1

Thanks for the response, Mantri. This is a good workaround. But why doesn't work there?

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Sergio Guerrero Nov 07, 2017 at 06:16 PM
0

this works for me:

<Text text="line line\n line two" />

<c:TimelineItem text="one one one\n two two" />

make sure you declare the namespace for the sap.suite.ui.commons

xmlns:c="sap.suite.ui.commons" in your view declaration

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi, Sergio,

The namespace declared in my view is sap.suite.ui.commons only. It is surprising to know that it works for you.

However, the workaround for this problem is to bind the text from i18n file.

0