cancel
Showing results for 
Search instead for 
Did you mean: 

maxLines in sap.m.text does not work correctly when set to 1.

former_member595374
Participant
0 Kudos

When maxLines is set to 2, everything is displayed as expected. However, when maxLines is set to 1, the only text that is displayed is "lorem ipsum" and there are no ellipises. Is there a fix for this?

var xColumnTemplate = new sap.ui.layout.VerticalLayout({
content: [new sap.m.Text({
text: "hello"
}), new sap.m.Text({
text: "world"
}),
new sap.m.Text({
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
maxLines: 1
})
]
});

Accepted Solutions (1)

Accepted Solutions (1)

mvaibhav
Contributor

Hi Betty,

It is happening because of the container(Vertical Layout) you have specified to add the texts.

The Layout control width is somehow taking precedence over the text control when length of 1 is specified for Text. (Not sure why). This also modified the property of text wrapping to false.

Remove the container(VerticalLayout) and the text should work fine.

Or try it with a different container (VBOX/FlexBox) to check if it works for you.

Thanks,

Vaibhav

former_member595374
Participant
0 Kudos

Thank you for your help! Changing it to vbox fixed the problem.

nabheetscn
Active Contributor
0 Kudos

Great Vaibhav I think it is a bug what is your take? we shall report it?

mvaibhav
Contributor
0 Kudos

Hi Nabheet,

Yes, looks like a bug to me. The text just goes beyond the page limit when maxLines is set to 1.

Answers (1)

Answers (1)

former_member592880
Participant

hello,

try instead of using maxLines, to disable wrapping. might work

S