Highlighting Rows

Highlighting Rows

manesh.mistrymanesh.mistry Posts: 4Questions: 0Answers: 0
edited June 2010 in General
I have loaded the DataTable with Json Data but when I go to try and highlight the rows using your

$('#example tbody td').hover(function() { .. script,

the 'td' selector does not seem to be recognised. It is recognised with $('#example tbody').hover(function() but that is not much use when I want to highlight the row.

Do you have another script for this scenario?

Replies

  • chandruchandru Posts: 17Questions: 0Answers: 0
    Hi.
    Use this,
    $('tbody tr').hover(function () {
    this.style.bachgroundcolor: '#cccccc';
    });
  • manesh.mistrymanesh.mistry Posts: 4Questions: 0Answers: 0
    Thanks for your help but $('tbody tr').hover(function () doesn't work either. Must be a Json and jquery selector issue but cannot work out what to do. Any other ideas? Here is the actual html.




    IDProduct





    IDProduct
  • codingavenuecodingavenue Posts: 22Questions: 0Answers: 0
    Hi,

    Have you tried creating css definition instead?

    e.g.

    #example tbody td:hover {
    color: #cccccc;
    }


    something like that.

    codingavenue
  • codingavenuecodingavenue Posts: 22Questions: 0Answers: 0
    Also if your using server-side then I think you have to do something like this

    [code]
    $('#example tbody td').live('hover', function() {
    //do something....
    });
    [/code]

    codingavenue
  • gresekorgresekor Posts: 2Questions: 0Answers: 0
    This works for me:

    [code]
    $("tbody tr").live("mouseover", function(){
    $(this).children().addClass("highlighted");
    });
    $("tbody tr").live("mouseout", function(){
    $(this).children().removeClass("highlighted");
    });
    [/code]

    Gregor
  • manesh.mistrymanesh.mistry Posts: 4Questions: 0Answers: 0
    It was the css definition, thanks codingavenue
This discussion has been closed.