In the initialation of datatables together with editor i use:
columns: [
{ data: "name", className: 'noEdit clickTextToOpenModal' },
I can set className within this line of code.
Is it possible to add data-attributes in this line to?
I would like to add something like:
{ data: "name", className: 'noEdit transactionModalBtn', data-bs-toggle="modal" data-bs-target="#transactionModal"},
where can i find all thoose commands availible?
Like: data:, className:, etc?
Is there one for data-atrributes?
If it's not possible, how should i add data-attributes to open modal, best practice?
UPDATE
I've now tried:
{ data: "name", className: 'noEdit transactionModalBtn', createdCell: function(td, cellData, rowData, row, col){$(td).data("data-bs-toggle", "modal"); $(td).data("data-bs-target", "#transactionModal");}},
I did not find a way to add the code inside:
columns: [
{ data: "name", className: 'noEdit transactionModalBtn'},
So i did this, and it worked:
columns: [
{ data: "name", className: 'noEdit transactionModalBtn'}
],
createdRow: function( row, data, dataIndex ) {
$( row ).find('td.transactionModalBtn').attr('data-bs-toggle', 'modal');
$( row ).find('td.transactionModalBtn').attr('data-bs-target', '#transactionModal');
},