Sorting rules with css

Sorting rules with css

megliomeglio Posts: 5Questions: 0Answers: 0
edited March 2011 in General
I have read all the help and cannot find is it possible to define sorting rules with css to TH elements? I need this mainly because columns change dynamically for different user types, and I do not know columns ordering, so I preferer some kind of metadata to be specified with using CSS.

Thanks,
Anton

Replies

  • allanallan Posts: 63,520Questions: 1Answers: 10,473 Site admin
    I'm not quite sure what you mean by "sorting rules" I'm afraid. Do you mean if a column can be sorted or not (bSortable)? If so then you could use aoColumnDefs with a target class (i.e. aTargets: ["nonsortable"], bSortable:false) and assign that class to any TH elements for the columns you don't want to be sortable.

    Allan
  • megliomeglio Posts: 5Questions: 0Answers: 0
    Thanks, Allan.
    I think that I got the idea, as for me it's was not enough clear in documentation.

    p.s. ... still cannot use your plugin because of bug, just described it here:
    http://datatables.net/forums/comments.php?DiscussionID=4781

    Regards,
    Anton
  • megliomeglio Posts: 5Questions: 0Answers: 0
    ... thanks for answering to my "bug report" (it was actually bad html formatting - absense of TR inside THEAD).

    1. Actually I have fewer columns available for sorting then the ones which must be not sortable. How can I turn off sorting for all columns except for ones with some class specified?

    2. Can you please refer to a docs about how to set different classes for different "sorted" states for TH elements - eg "unsorted", "sorted asc", "sorted desc" - is it possible?

    Thanks very much for your help!

    Anton
  • mgmg Posts: 47Questions: 0Answers: 0
    @meglio: With respect to item 2. in your question, is the documentation here
    what you're searching for?
    http://datatables.net/styling/ids_classes
This discussion has been closed.