views:

49

answers:

1

First off, I'm using version 3.7.1 with a jQuery UI framework theme. I'm trying to figure out how to have a newline or even a <br /> render inside of a jqGrid cell.

An example of what I'm looking to have happen:

________________________________________________________
Item 1     |   some data   |  Applies to OS 1
                              Applies to OS 2
                              Applies to OS 3
                              Applies to OS 4
__________________________________________________________
Item 2     |   some data   |  Applies to OS 1
__________________________________________________________
Item 3     |   some data   |  Applies to OS 4
                              Applies to OS 5
__________________________________________________________

What currently happens when my data has either a <br /> or a \n is:

__________________________________________________________
Item 1     |   some data   |  Applies to OS 1Applies to OS 2Applies to OS 3Applies to OS 4

I would rather not have to use an actual <br /> tag, since I'd rather not have HTML embedded in my data, but am willing to do whatever I have to since I NEED to render this data as a list of values. Thanks for any help.

+1  A: 

You should use custom formatter (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter) for the column where you need to have <br />. This allow you to defina any HTML fragment for a column. See http://stackoverflow.com/questions/2991267/jqgrid-editable-column-that-always-shows-a-select/2992064#2992064 as an example.

Probably http://stackoverflow.com/questions/1730061/wrapping-text-lines-in-jqgrid will be also helpful for you.

P.S. If you will have problems with the usage of custom formatter, post a column definition and a raw data example (JSON data for example) for the column where you want have <br/>

Oleg
Thanks again Oleg. I did implement a custom formatter, but the main result was achieved by me removing the usage of the ui-ellipsis CSS class on the columns and adding the style shown in your third post link. Thanks for your help.
Billyhole