PDA

View Full Version : Displaying a formatted plain text in message box.



santosh.kumar
20 May 2013, 10:46 AM
Hi,

Is there a way or different control to display a formatted plain text in message box?

Basically, i am getting response, a formatted (with new lines, spaces ) plain text, from server which i want to display in client.

Thanks

skirtle
20 May 2013, 4:47 PM
It depends on precisely what you want but pass the text through some combination of Ext.util.Format.nl2br and Ext.util.Format.htmlEncode, perhaps wrapped in a PRE tag or the CSS equivalent.

e.g.:


var text = '<te xt>\n<te xt>';

Ext.Msg.alert('Title', '<pre>' + Ext.util.Format.htmlEncode(text) + '</pre>');