How to remove 'highlight' of a row?

How to remove 'highlight' of a row?

razvanrazvan Posts: 11Questions: 3Answers: 0

Hi,

I tried modified example here https://datatables.net/examples/advanced_init/row_callback.html like
"createdRow": function ( row, data, index ) {
if ( data.highlight == 1 ) {
$('td', row).addClass('highlight');
}
}
. This marks a whole row ba changing each 'td' in 'tr'. However I want that on click on a row the highlighted text reverts to normal. I tried several possibilities but couldn't reset the class of each 'td' in row. Do you know any possibilities to do this without reinitializing the table?

Thanks!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,815Questions: 1Answers: 10,517 Site admin
    Answer ✓

    Sounds like you just want to use $('td', this).removeClass('highlight'); where this is the row (i.e. in an event handler that is attached to the rows). Does that make sense?

    Allan

  • razvanrazvan Posts: 11Questions: 3Answers: 0

    Works Allan, thanks a lot!

This discussion has been closed.