columns data, get data from specific calculated td value
columns data, get data from specific calculated td value
i have this
columns: [
{ data: "advertisers.id_am" },
{ data: "incomes.clicks" },
{ // TOTAL FACT.
data: null, render: function ( data, type, row ) {
var total_fact = +data[8] + +data.incomes.accumulated;
return total_fact;
}
} ]
data[8] is the value for field VALIDATED
i'm getting a NaN value right now.
that data[8] is a calculated from other values, it is not saved in data.incomes.validated ( in that case i have already the solution)
how can i get that data[8] value??
thanks
Answers
Looks like your data is object based not array based and you are trying to access the value as an array:
data[8]
. Its unclear to me from your description what objectdata[8]
is. Sounds like it should bedata.incomes.validated
but you indicate its not.You will need to change
data[8]
to point to the object with that value.Kevin
Could you clarify why you've marked Kevin's answer as rejected please? It is basically exactly what I would have said as well.
Allan
in other words, the a current <td> value for that calculated column
Kevin's said the same as i said, that's why i reject answer.
Thing is that i need to get the <td> value, because it's calculated and dinamic value.
i can't data.incomes.validated becuse it's NULL and data[8] gives a [Object object]
please help
I would have expected
data[8]
to give undefined since the data source appears to be an object, not an array.But really we'd need either a test case or at least a debug trace to understand the data object.
Allan
maybe $('td', currentRow).eq(8).text() ??
i end up with a solution:
var modifier = editor.modifier();
var currentRow = table.row(modifier).node();
return $('td', currentRow).eq(8).text();
that is
You are using the
editor
variable inside a rendering function? That would only work if Editor has been put into an edit mode. Otherwise it will just return null.Allan
****