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.

Billyhole
  • 1,688
  • 3
  • 20
  • 32

1 Answers1

1

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 jqGrid: Editable column that always shows a select as an example.

Probably 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/>

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • 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 Jun 23 '10 at 19:46