Background color of selected column

Background color of selected column

ChrilleChrille Posts: 19Questions: 0Answers: 0
edited January 2011 in General
I'm using fnRowCallback to add a class of each TR that contains item that are out of stock:
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
if(aData[6] == "SOLD OUT")
$(nRow).addClass("disabled");

return nRow;
}
[/code]

My css:
[code]
tr.disabled { background: #ccc; color: #999; }
[/code]

This works fine, except when I click a column to sort, insted of gray background the sorted field gets a blue background (as all other rows).

How do I style so that does'nt happen?

Replies

  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    edited January 2011
    hi Chrille,

    I think it's because, after sorting the rows are getting shuffled and classes are overridden by some other classes. even while sorting dataTable applies classes to each td.
    for more clarification you can go through this.....http://www.datatables.net/styling/

    Thanks,
    Vivek
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    It's to do with CSS priority - simply that the ordering class has a higher priority (it's more selective) so it is winning out. If you have a look in Firebug, it will confirm this. One approach is to use !important to ensure that your style "wins out".

    Allan
This discussion has been closed.