linebreaks render
linebreaks render
Rectec013
Posts: 42Questions: 10Answers: 0
Hello , i have a json object like ["1","2"] and i want to use a render for linebreaks .
i tried {
"render": function(data, type, row){
return data.split(", ").join("<br/>");
}
but it doesn´t work .
any Idea ? Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Split is for a string. You are dealing with an array.
ooops, left off a quote above
thanks but it doesn´ t work .
{
"render": function(data, type, row){
return data[0] + "<br />" + data[1];
}
i have in my table a comma separated text , and i am trying to find a way to put a <br /> at one or more columns .
Use
Array.prototype.join
to join an array.Allan
Thanks Allan .
The problem is that a have a text list with comma separated text .
I need to show on my tabel one column by one , separated data .
1,2,3,4,5,6,6,7,8,9
1,2 column one
3,4 column two
Josh
if your data is in the form of arrays of numbers as string as you show at the top,
I built an array of numbers using random integers so it looks like;
I created two tables, one that shows each value (8 x 10 table)
I created a second table that is 4 x 10 table that combines numbers with a <br>. You can see it here http://live.datatables.net/qerogefi/1/edit
Thanks for Help bindrid .
what i have on my table is in each row (not column , sorry ) 2 number with comma separated .
your Code Work perfectly by the way
Josh
I don't give up easy.
"1,85,69,96,80,51,10,31,80,50,33,5,93,91,58,73,34" for data at
http://jsbin.com/beyaxek/edit?html,js,output
thanks for Help but i can t open it can you post it in another plattform please .
html:
Thanks bindrid , it works
Josh