how can I add a button in each table row that downloads a different linked file?
how can I add a button in each table row that downloads a different linked file?
lpace
Posts: 12Questions: 6Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Answers
here's what I had so far. it shows the link in the column, but I'd prefer to have a button there
var my_datatable = $('#my_datatable').DataTable({
'ajax': {
'url': 'http://localhost:9090/dashboard-data'
},
'columnDefs':[
{
'data':'null',
'defaultContent':'<button>Download</button>',
'targets':'-1'
}
],
'dom': 'lfrtBip',
'buttons': [
{'extend': 'csv',
'text': 'Export',
exportOptions: {
modifier: {
search: 'none'
}
}
},
{
'text': 'Reload',
'action': function ( e, dt, node, config )
{
dt.ajax.reload();
}
}
],
'select':'true',
If you want to add button in each row you could simply use the render function to do that, something like this