Add custom attribute to all non-header cells

Add custom attribute to all non-header cells

bobpaternobobpaterno Posts: 2Questions: 1Answers: 0
edited July 2018 in Free community support

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

This discussion has been closed.