Undocumented feature-option columns.class

Undocumented feature-option columns.class

womplifywomplify Posts: 30Questions: 3Answers: 0

there is the columns.className option, which determines the class of a column's cells..
However, there is ALSO (apparently) an undocumented "feaure" in the form of an option, called columns.class (without the Name part). The difference between the two is that .class applies the classes specified to the column's header cells as well, and not only the data.
This is very handy, when for example you want to apply a class like text-right, to a column, but instead of both having to define it in the html of the thead, as well as in the columns definition for that specific column, you just define it in the columns definition.

Allan.. is that indeed a feature? or a glitch??

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    columns.className will apply to the header as well - see this example.

    The fact that columns.class works is an artifact of the backwards compatibility for the old Hungarian notation parameter style, where that parameter was called sClass. The camelCase version of that is simply class but class is a reserved word in Javascript. It can be used in objects, but there are edge cases where it could cause issues, hence why I recommend using columns.className. They should be identical.

    Allan

This discussion has been closed.