Add custom attribute to all non-header cells
Add custom attribute to all non-header cells
![bobpaterno](https://secure.gravatar.com/avatar/ad02583336643d3126a101489b1518b3/?default=https%3A%2F%2Fvanillicon.com%2Fad02583336643d3126a101489b1518b3_200.png&rating=g&size=120)
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