在jqGrid单元格中的数据中呈现换行符 [英] Render a newline in my data inside a jqGrid cell
问题描述
首先,我使用版本3.7.1与jQuery UI框架主题。我试图找出如何有一个换行或甚至一个< br />
渲染在jqGrid单元格内。
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.
我希望发生的一个例子:
________________________________________________________
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
__________________________________________________________
目前发生在我的资料有< br />
或\\\
is:
__________________________________________________________
Item 1 | some data | Applies to OS 1Applies to OS 2Applies to OS 3Applies to OS 4
我不想使用实际的< br />
标签,因为我宁愿没有HTML嵌入我的数据,但愿意做我所需要的,因为我需要渲染数据作为值列表。
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.
推荐答案
您应该使用自定义格式化程序(请参阅 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter )您需要拥有< br />
。这允许您定义列的任何HTML片段。请参见 jqGrid:可编辑的列,其中始终显示select < 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 jqGrid: Editable column that always shows a select as an example.
可能在JqGrid 中封装文字行也会对您有所帮助。
Probably Wrapping Text lines in JqGrid will be also helpful for you.
PS如果您对自定义格式化程序的使用有问题,请为您希望具有< br /> $ c的列发布列定义和原始数据示例(例如,JSON数据) $ c>
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/>
这篇关于在jqGrid单元格中的数据中呈现换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!