display data differently in AJAX table
display data differently in AJAX table
mesqueeb
Posts: 38Questions: 12Answers: 1
How can I display data differently in an AJAX table?
E.g.:
$('#myTable').DataTable( {
ajax: ...,
columns: [
{ data: 'name' },
{ data: 'price' },
{ data: 'id' },
]
} );
I want to make the following two column changes:
{ data: 'price' } → price*1.08
{ data: 'id' } → "http://url.com/"+id
And I want to have one column that can show 2 values from the JSON, e.g. firstname+" "+lastname
I've looked into https://datatables.net/reference/option/columnDefs
but I failed to figure out how to use this in combination with my AJAX setup.
Any ideas?
This discussion has been closed.
Answers
Here I found how to use 2 values in 1 string:
http://datatables.net/examples/advanced_init/column_render.html
But do I need to add the second value I want to use to a different hidden column?
Or is there a way to get two values of the AJAX data in the same column?