changing row color and link color on callback

changing row color and link color on callback

chris.cavagechris.cavage Posts: 46Questions: 12Answers: 0
edited August 2016 in Free community support

I am changing the row color on callback if needed based on this code:

"fnRowCallback": function(  nRow, mData, iDisplayIndex ) {
                
                if(mData['return_date'] != undefined || mData['return_date'] != null) {
                    $(nRow).css('color', 'red');
                }

It does NOT apply to links. I know I need to apply a CSS rule to tr a:hover for instance, but how can I target the link in the row based on the code I'm using?

$(nRow+'a:hover').css('color', 'red');

Something like that?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,813Questions: 1Answers: 10,516 Site admin
    Answer ✓

    I would suggest adding a class to the row and then using plain CSS to target that specific class (and any child elements / selectors that you need to use). It will be a lot easier and more maintainable that trying to get CSS like that into JS.

    Allan

  • chris.cavagechris.cavage Posts: 46Questions: 12Answers: 0

    Great idea. That worked. Thanks.

This discussion has been closed.