columnDefs : add a class to all columns

columnDefs : add a class to all columns

MelodyNelsonMelodyNelson Posts: 213Questions: 33Answers: 2

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Hi,
Is there a shortcut version to add a class to all the columns in columnDefs so I don't have to write all targets like that ?
```
{ className: 'valign-top', targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] }

I don't want to change the CSS of the original <td> because I have multiple datatables and only one of them need this additional style.

Thank you.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,953
    Answer ✓

    See the columnDefs.targets docs for all the options. Use "_all" to choose all the columns.

    Kevin

  • MelodyNelsonMelodyNelson Posts: 213Questions: 33Answers: 2

    hahaha, I've tried all without the underscore, I've read the page and miss the line with _all. The heat have already damaged my brain !
    Thanks Kevin

Sign In or Register to comment.