Reputation: 89
I have these columns:
columns: [
{data: 'values.0.2'},
{data: 'values.0.3'},
{data: 'values.0.4'},
]
I need to get its value separated by commas within a span like this:
render: function(data, type, row, meta){
var sequence = "<span class='row.bar'>"1,2,3</span>";
return sequence
In other words, you need this:
<span class='row.bar'>"VALUE ROW 1,VALUE ROW 2,VALUE ROW 3</span>";
Example:
If this:
columns: [
{data: 'values.0.2'},
{data: 'values.0.3'},
{data: 'values.0.4'},
]
Show this:
<td>1</td>
<td>2</td>
<td>3</td>
I need:
<span class='row.bar'>1,2,3</span>
Someone has knowledge on how to get this. Thank you.
Upvotes: 0
Views: 2901
Reputation: 327
You can use cell()
method to select the cells you need, then use data()
to get the values
docs: https://datatables.net/reference/api/cell() , https://datatables.net/reference/api/cell().data()
I get this working in my local project like this:
table.row(0).data()[0]
or this
table.row(0).cells().data()[0]
I don't know why cell() isnt working propperly, according the docs we're using it well, btw, I think you can solve your problem this way :)
Upvotes: 0