Multiple Ajax Objects in One Cell
Multiple Ajax Objects in One Cell
![dbalders](https://secure.gravatar.com/avatar/1768cb2f23b64b810d07383d1de9b26c/?default=https%3A%2F%2Fvanillicon.com%2F1768cb2f23b64b810d07383d1de9b26c_200.png&rating=g&size=120)
Hello,
I am using ajax to populate my datatable. Our rest server has 2 objects for Name, one for first name, and one for last name. In my datatable, I want to combine those into one cell instead of needing to split it into two. Here is my current code:
$('#summary-contacts-table').dataTable({
ajax: {
url: restURL,
dataSrc: ""
},
dom: "Tfrtip",
bInfo: false,
searching: false,
paging: false,
columns: [
{ "data": "name_first" },
{ "data": "role" },
]
});
For the "data": "name_first"
, I want it to be something like "data": "name_last" + ", " + "name_first"
but the few ways I have tried to do this have resulted in datatables errors. Has anyone done something like this before? Is there a way to squish that data into one cell?
Thanks,
David Balderston
This question has an accepted answers - jump to answer
Answers
Amazing! Thank you very much ignignokt!