Having trouble combining render functions
Having trouble combining render functions
I have a textarea within my datatable and I currently use the ellipsis renderer to limit the initial display to 70 characters, but I also need to make sure 'carriage returns' and 'line feeds' are respected as well, I can do this by replacing \n or \r with <br> which works fine, but I do not know how to combine these two as one line.
The two separate working renders are as follows:
, render: $.fn.dataTable.render.ellipsis(70, true, true)
or
, render: function(data) { return data.replace(/(?:\r\n|\r|\n)/g, '<br>') }
So, could someone please tell me how to write the above two lines into one line of code?
Thanks, Chris
This question has an accepted answers - jump to answer
Answers
This example here is doing something similar to that. It calls the
ellipsis()
function first, then doing other stuff with the string,Colin
Thank you Colin