Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by richard white on Nov 11, 2008 12:43
open dhtmlx forum
Word wrapping in grid cells

Hi

is there a way to wrap text in a grid cell of type 'ro'

for example. if i have a cell that is approx 100px in width and i have text that is longer than that, i want the height of the cell to expand and create rows out of the text, so instead of appearing on 1 line it appears on 2 or more (depending on how many it needs)

is this possible?

thanks
Answer posted by Support on Nov 12, 2008 02:56
You can use multiline mode of grid. In such mode data will be auto-wrapped for all cells in grid.
          grid.enableMultiline(true);
Answer posted on Nov 12, 2008 03:48
this works fine, except the height of single rows seems to have shrunk considerably, and the rows are now very close up. is there a way to change the padding on the cells so they have the same amount of space as they would have without the multi-line being enabled?

if i have to change the css or js can you point me to the line to change please

thanks
Answer posted by Support on Nov 12, 2008 04:14
In multiline mode, height of row defined barely by content, it has not extra spacing as in default mode ( where height of row is fixed ) 
You can change the default height of rows by adding next css rule

<style type="text/css" media="screen">
 div.gridbox table.obj td {
  padding-top:2px;
  padding-bottom:2px;
 }
</style>

Answer posted on Nov 12, 2008 04:16
thanks for this, except where exactly should i add this?

thanks
Answer posted by Support on Nov 12, 2008 04:24
Anywhere in your HTML file , after including standard grid's css 
( or you can add it to the end of existing dhtmlxgrid.css ) 
Answer posted on Nov 12, 2008 04:27
thanks for your help, this works well!