Add custom attribute to all non-header cells
Add custom attribute to all non-header cells
What's the most efficient way to add a custom attribute to every cell in the datatable during initialization.
Our tables have a lot of columns and I'd like to add a tooltip that pops up in each cell that displays the column header.
When I tried below code, I never got the alert. Wondering if it didn't work because there were other column defs that hid specific columns. Wondering if targets: "_all" doesn't work when you are using targets: <number> elsewhere in the columnDefs?
columnDefs: [
{
targets: "_all",
createdCell: (td, cellData, rowData, row, col) => {
alert('here');
// do stuff
}
},
{
// other specific column defs
}
]
This question has an accepted answers - jump to answer
Answers
Nope,
This simple example works (have console open when you run it)
http://live.datatables.net/yonewafu/1/edit
Confirmed, thanks