PDA

View Full Version : Wrap text in a grid cell



vaggelis
28 May 2010, 12:16 AM
Is it possible to wrap text in a GridPanel or ListView cell ?

I'd appreciate any help!!

wm003
28 May 2010, 12:41 AM
Try to use HTML code like <br> for your Gridstore.

vaggelis
28 May 2010, 1:32 AM
Thank you wm0033!!!

Your solution works fine on columns with fixed width.
However,it would be desirable to have resizable columns, where data would be wrapped properly to grid cells.

wm003
28 May 2010, 4:05 AM
That's not the way the Ext-Grid was designed for, but with some css tweaking for the cells it should be possible. You may override some "white-space" attribute for grid cells, but i guess this will result in a real mess, because of the given rowheight....I would try playing with Firebug on the css-cell-attributes first. Good luck :)

PerlDiver
29 Jul 2010, 12:34 PM
renderer: function(value, metadata) {
metadata.attr = 'style="white-space: normal;"';
return value;
}, in the column config.

tecnico12
29 Jun 2012, 6:20 AM
In Extjs 4.0.7 this is the code for wrap text in a grid cell:



renderer: function(value, metadata) {
metadata.style = 'white-space: normal;';
return value;
},

ananthk
1 Apr 2013, 11:44 AM
Very good Solution!