Using mRender to display boolean value
Using mRender to display boolean value
jacomo
Posts: 2Questions: 2Answers: 0
Hello,
I want to change the true/false value displayed to yes/no .
I am using the mRender as follows
<script>
var table = $('#productTable').DataTable({
"aoColumnDefs": [{
"aTargets": [5] // Here we have to give the target column for which value conversion(manipulation) takes place
,
"mRender": function(data, type, row) {
return (row[5] = "true") ?
"yes" : "no";
}
}]
});
but I always get yes no matter if the boolean value is true or false. Can you help please?
This discussion has been closed.
Answers
Try it with
==
on line 7 -=
is just an assignment.C
You need row[5] == true (comparison operator)
otherwise you are just assigning the value "true".