在JQuery Datatables单元中断行。

时间:2021-09-18 14:29:06

I'm populating a datatables cell via Ajax and JSON. To get line breaks in a list of names in a a cell I've tried \n and escaped \n (\\n). Neither work.

我正在通过Ajax和JSON填充datatables单元格。在一个单元格中,我试着用\n (\\n)来获取一个名字列表中的换行符。既不工作。

Thanks

谢谢

1 个解决方案

#1


2  

I suspect this is because your cell is HTML so \n ,not being a valid HTML markup, is not causing a line break. A <br/> element will likely cause a link break in your case, however without sample code from you it is hard to know.

我怀疑这是因为您的单元格是HTML,所以\n不是有效的HTML标记,不会导致换行。在你的例子中,
元素很可能会导致链接中断,但是如果没有示例代码,就很难知道。

#1


2  

I suspect this is because your cell is HTML so \n ,not being a valid HTML markup, is not causing a line break. A <br/> element will likely cause a link break in your case, however without sample code from you it is hard to know.

我怀疑这是因为您的单元格是HTML,所以\n不是有效的HTML标记,不会导致换行。在你的例子中,
元素很可能会导致链接中断,但是如果没有示例代码,就很难知道。