How do I add a Custom Column?
How do I add a Custom Column?
HillChris1234
Posts: 27Questions: 13Answers: 2
I've read the articles on defaultContent and render, but they aren't helping.
Basically what I want to do is create a column where text is concatenated to the data when it's rendered. So, something like:
$('#myTable').DataTable({
"ajax": {
"url": "/Brokers/loaddata",
"type": "GET",
"datatype": "json"
},
"columns": [
{ "data": "Code" },
{ "defaultContent": "Your code is " + data.Code }
]
});
This would create 2 columns. One would have the Code returned from the Json. The other would have the code concatenated onto a string saying "Your code is ".
This discussion has been closed.
Answers
I figgered it out! Here's the answer: