Get the value of a cell in datatables

Get the value of a cell in datatables

albertodentealbertodente Posts: 3Questions: 2Answers: 0

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 obtain this. Thank you.

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @albertodente ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.