sClass is being applied to table headers

sClass is being applied to table headers

mspanglermspangler Posts: 2Questions: 0Answers: 0
edited March 2011 in General
When using the sClass option for aoColumnDefs I noticed that it's applying the class to the element as well as to the elements for that column. I didn't think it was suppose to apply this to the elements. Am I wrong or do I have another issue going on to cause this?

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    This is intentional as it can be used to identify a whole column, including the header. If this is effecting your CSS or DOM, you can just add an 'thead / tbody' condition to your selector :-)

    Allan
  • cavocavo Posts: 1Questions: 0Answers: 0
    hi,
    actually sClass doesn't gives class to "each" cell in column. it doesn't work for cells in tfoot.
    example for 3-column table with tfoot row for sums:
    ...
    .red{ color: red; }
    ...
    $("table").dataTable({
    "aoColumns": [
    {"sClass": "red"},
    {"sClass": "red"},
    {"sClass": "red"}
    ]
    });
    ...


    TOTALS
    sum of col b
    sum of col c



    data in last row aren't red. if this is right behavior, i suggest to edit purpose of sClass in reference: "Class to give to _each_ cell in this column.".

    i think it should work for tfoot too. for example: if numeric data are in column i give alignRight class to this column. in footer there is sum for each row in that column, so it should has this class too.
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    I think that's a fair point! Bug noted for 1.8.3 :-)

    Thanks,
    Allan
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Just committed in - it will be in the 1.9 beta that should be along soon :-).

    Allan
This discussion has been closed.