Highlighting row on click.

Highlighting row on click.

jQuery_userjQuery_user Posts: 27Questions: 0Answers: 0
edited November 2010 in General
Hello fellow DataTables users,

I am using following code to highlight row on click:

[code]$("#tableId tbody tr").live("click", function(event){
$("td.row_selected", oTable.fnGetNodes()).removeClass('row_selected');
$(event.target).parent().find("td").addClass('row_selected');
});[/code]

This works fine in IE, but not in firefox.
I also have a click event like this:

[code]$('#tableId tbody tr').click( function () {
var aData = oTable.fnGetData( this );
alert( aData[1] );
} );[/code]

In firefox, it seems the even/odd classes are over-riding the 'row_selected' class.
How to solve this.

Regards.

Replies

  • doncullendoncullen Posts: 32Questions: 2Answers: 0
    Add !important to the row_selected class in your CSS.

    Example:

    [code].row_selected {
    background-color: yellow !important;
    }[/code]
  • jQuery_userjQuery_user Posts: 27Questions: 0Answers: 0
    Hi Doncullen,
    I already added that to my CSS. What else could be missing. It works fine in IE, but not in Firefox.

    Thanks
This discussion has been closed.