Style both rows in thead

Style both rows in thead

wacki4wacki4 Posts: 4Questions: 0Answers: 0
edited July 2011 in General
Hi!
I have one problem with datatables:

When I use individual filtering on columns, I made second with like these:
[code]

id
title





[/code]

but, when I change sorting, in first row, second row won't change style.

How to make second one changing a style on sorting action?

Thanks for help.

Replies

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    Which version of DataTables are you using? In 1.8.x it should be that the sorting class is, by default, applied to the bottom row - this can be overridden with http://datatables.net/ref#bSortCellsTop .

    Allan
  • wacki4wacki4 Posts: 4Questions: 0Answers: 0
    edited July 2011
    I have 1.8.1, but it seems that you don't see problem that I except, or what I want to happend after sorting.

    I'm using bSortCellsTop, and it work perfectly, with one 'but'. When my top row is sorting one, i want to make second row of thead darker, like first one. But it won't work. Second row of thead don't get any class or style, it remains the same like before sorting.

    Is there any possibility or simple hack, to make second row darker like the first one?
  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    Oh I see - I'm afraid there isn't a built in solution for this in DataTables - it only alters the class of the TH element that is controlling the column. What you would need to do is have a draw callback function (fnDrawCallback) which will remove old classes from the second TR in your THEAD and then apply the new classes as required by the sorting classes applied by DataTables to the main row.

    Allan
  • wacki4wacki4 Posts: 4Questions: 0Answers: 0
    but how to get list of columns that i'm sorting on?
  • wacki4wacki4 Posts: 4Questions: 0Answers: 0
    edited July 2011
    ok i made it like these:

    [code]fnDrawCallback: function () {
    var thlisth=$(this).find('thead >tr:first-child >th');
    var thlistf=$(this).find('thead >tr:last-child >th');
    for(i=0;i
This discussion has been closed.