DataTables: Add class to table cells, but not table headers?

DataTables: Add class to table cells, but not table headers?

emtemt Posts: 46Questions: 10Answers: 0

I'm using the following code to initialize jQuery DataTables:

var oTable = $('#qpidvulh_to-do_list').dataTable( {
    "columns": [
        {
            "data": "item",
            "className": "editable"
        }
    ]
} )

The issue with this code is that it adds the editable class to the th of each column, even though I only want it added to the td of each column.

How can I get the code to only add the editable class to the cells of each column and not their headers?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    How can I get the code to only add the editable class to the cells of each column and not their headers?

    There is no option for that in DataTables. If this is causing an issue for your editing, I would suggest simply making your selector that is selecting the items to be edited a little more selective by adding a tbody input it.

    Allan

This discussion has been closed.