Changing Column Value
Changing Column Value
raisonco
Posts: 17Questions: 5Answers: 0
I want to display a different value to that stored in the database in the datatable.
For example if I have 'merged' in the DB then I want to display 'Merged Infrastructure'.
I currently use:
{
"data": "schedule_items.component"
}
To get the database values. How could I amend the output?
For example:
if (schedule_items.component == 'merged') {
$output = 'Merged Infrastructure''
} else if (.....
Thanks!
This discussion has been closed.
Answers
The
columns.render
option is used to change the displayed values. There is an example here:https://datatables.net/examples/advanced_init/column_render.html
Kevin
Thanks for the help. In case this helps others, here is how I coded it in the end: