Fill the field via another field
Fill the field via another field
antoniocib
Posts: 277Questions: 62Answers: 1
in DataTables
Hello everybody,
I would need to bind the value to a field via another field, example:
Row A:
Field 8: "SA"
Field 9: "Campania"
I try in this mode but dont work:
{
"data": "prov_destinatario"
},
{
"data": "tratta",
render: function ( data, type, row ) {
if ( data.prov_destinatario == "SA" ) {
return 'Campania';
}
else if (data.prov_destinatario == "TE") {
return 'Adriatico';
}
},
className: "dt-body-center",
}
Can help me pls?
Answers
Did you check the content of "data", "type" and "row" in you debugger? Should be easy to figure this out.
Try this:
You also need to make sure you return something in case neither of the two conditions is being met. In that case you return "data" which is the same as "row.tratta".
Thanks @rf1234 but i solved with a Left Join!!
Thanks for the support