How to add Hyperlink and button column in Datatable Grid
How to add Hyperlink and button column in Datatable Grid
var tblN = $('#MyTable').DataTable({
responsive: true,
dom: 'Bfrtip',
buttons: [
'copy',
'excel'
],
data: itemsArr,
columns: [
{ data: 'MainCol' },
{ data: 'Col1' },
{ data: 'Col2'},
{ data: 'total' }
],
});
the above data is coming from AJAX web service call and we have used the columns to set the data table with column name. Now I want to add one more extra column with Hyperlink and button column in Grid but I was not able to do so. I have tried columnDefs, columns.render, and other articles on Custom column and also refer following article:
https://datatables.net/release-datatables/examples/ajax/null_data_source.html
but not able to add them. Please help me with the data: myItemArray and suggest me the way to add column
Answers
One option is to use a renderer.
Allan