How to prevent aoColumnDefs applying to header and footer in DataTables?

How to prevent aoColumnDefs applying to header and footer in DataTables?

darkhorndarkhorn Posts: 4Questions: 0Answers: 0
edited February 2013 in DataTables 1.9
This is a part of my code where I apply class name into table cells.

[code]"aoColumnDefs" : [{
"sClass" : "email",
"aTargets" : [0]
}][/code]

However it applies also into tfoot and thead ths. How I can make it apply only into tbody th?

Replies

  • BLSullyBLSully Posts: 24Questions: 1Answers: 0
    The "easy" answer is whatever CSS rules you're writing for the table, just make them more explicit:

    [code]
    tbody .email {
    //rules
    }
    [/code]

    instead of
    [code]
    .email {
    //rules
    }
    [/code]

    Same applies if you're using the class to bind events:

    [code]
    $('#myTable').on('click', 'tbody .email', function() {});
    [/code]
  • darkhorndarkhorn Posts: 4Questions: 0Answers: 0
    Great! It worked. BLSully , thank you very much!
This discussion has been closed.