PDA

View Full Version : Updating container with text - Line Breaks



hermann.s
17 Jan 2014, 6:50 AM
Greetings,

I have a container that I use the update() method to show some text that I retrieve from a webservice.

The text that is returned from the webservice looks like :



ABC.

DEF. GHI.


However, after updating my container, the text shows up like this :



ABC. DEF. GHI.


Line breaks are missing. How can I fix this?

scottmartin
17 Jan 2014, 7:18 AM
It would be helpful to see some code. Perhaps you could duplicate the incoming text and the code you are using to update in our fiddle:
https://fiddle.sencha.com/#home

skirtle
17 Jan 2014, 10:31 AM
The update method expects HTML, not plain text. As such, all whitespace will be collapsed down into a single space character.

You can use Ext.util.Format.nl2br to convert the line breaks into br tags. You might like to consider running it through Ext.util.Format.htmlEncode first.