How can I replace comma with new line?
How can I replace comma with new line?
Zeeker4730
Posts: 2Questions: 1Answers: 0
One of my column have this data : Function ID=rp005,Function Name=TestEditValue
and it show in the column like this :
due to the result, instead of showing comma I want it to make a new line.
I think I could use a .render in columnDefs and traget to [4] (reference column)
https://datatables.net/reference/option/columns.render
or who have better idea please guide me.
And here my code when I generate columns:
columns: [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{data: 'actionDate'},
{data: 'menu'},
{data: 'type'},
{data: 'reference'},
{data: 'actionBy'},
{data: 'field'},
{data: 'groupName'}
],
"columnDefs": [
{"targets": [6], "visible": false}
],
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Yep,
columns.render
is the way to go there.Ok, so I use this code Insert to columnDefs and It's work!!!
Hi all, I'm having the same problem as above, however I'm still unable to get this to work. can someone please advise?
My code is below:
dataTableClient = $('#ClientList').DataTable({
Sorry forgot to add the error message, see below:
mData.split is not a function
What is the data in the column? The split() method is used with a string. Sounds like it might be something other than a string.
If you still need help please provide a link to your page or a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Hi, yes I found that the mData was an object and not a string. I set a new variable as a string and used that to perform the split. This seemed to work.
mData2 = mData + ''
Many thanks.