How to keep return carriage (\r\n ) in the table column.

How to keep return carriage (\r\n ) in the table column.

Ikill75Ikill75 Posts: 3Questions: 1Answers: 0
edited January 2020 in Free community support

http://live.datatables.net/vegayade/1/edit?html,js,output

var dt = [
{"ABC":"111111111","NAME":"NAVY PIER \r\nDANCE CLUB\r\nRT 12 BLDG 007","ADDRESS":"NAVY PIER BLDG 425\r\nSUBMARINE HOUSE BOX 21\r\nCHICAGO IL 06340","MRY":"1980"},
{"ABC":"222222222","NAME":"BAR ONE\r\nDRINKS","ADDRESS":"123 N WELLWOOD AVE\r\nLINDENHURST NY 22222","MRY":"1957,1958"},
{"ABC":"333333333","NAME":"SEARS","ADDRESS":"505 STEWART AV \r\nGARDEN CITY NY 55555","MRY":"1961,1962,1963,1964"}
];

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394
    Answer ✓

    You would need to replace "\r\n" with the HTML tag <br />.

  • Ikill75Ikill75 Posts: 3Questions: 1Answers: 0

    I'm using ajax to get the data and when JSON.parse() is used it removes "\r\n".

  • Ikill75Ikill75 Posts: 3Questions: 1Answers: 0

    Thank you, I replaced it before doing JSON.parse().

This discussion has been closed.