DataTables: How to set classes to table row cells (but not to table header cells!)

前端 未结 4 1215
轻奢々
轻奢々 2021-02-05 10:36

i have a really nice style for my tables.

{ sorry links no more working }

I had to add sClass so that new rows (added by fnAddData) get the right classe

4条回答
  •  无人及你
    2021-02-05 10:50

    Since you are only using sClass to apply styling to the table the simple solution to your problem is to modify the CSS itself to only apply to the td elements.

    Old CSS style:

    .avo-light {
        color: blue;
    }
    

    New CSS style:

    td.avo-light {
        color: blue;
    }
    

    This way the CSS will only effect the cells you are interested in applying the style to despite sClass being applied to th elements as well.

    I realize this question is a little old, but I find it substantially more modular than the best solution.

提交回复
热议问题