View Full Version : String in displayfield does not wrap if no spaces in string.

17 Jun 2013, 1:48 PM
As seen if the following screen shots, a long string in a displayfield wraps at the right side of the container, but if the string value in the displayfield has no spaces, wrapping does not occur.

BAD - NO WRAPPING ("title" string is actually much longer than you see, but it is truncated, not wrapped)


GOOD - IS WRAPPING - Title is long but not truncated, it wraps.

17 Jun 2013, 3:12 PM
What you want is known as HARD WRAPPING but I dont think it is available on a displayfield as it is textarea functionality. You could put a renderer on your display field to break the title up as you want.

18 Jun 2013, 8:48 AM
Okay, I guess I need to use a textarea. But then I want the textarea to not have a vertical scrollbar, and to simply resize height as necessary to display entire text. How would I do that?

Alternatively, can I have a renderer as you say, where I force the displayfield to wrap at a specific width? So if the displayfield width is set to 400px, then renderer would wrap text at 400px even with no spaces, producing 2, 3 or more lines of text?

Which approach is better, easier, doable?

Thanks in advance.

18 Jun 2013, 2:42 PM
The displayfield is the correct element so I'd write a renderer. Something like this (untested)

renderer: function(val){
var retVal = "";
retVal =+ v + "\n";
}, this);
return retVal;