How to color TOP 5 rows?

How to color TOP 5 rows?

danielrodrigodanielrodrigo Posts: 1Questions: 1Answers: 0

Hello

It's possible to color TOP 5 rows with a highlight color?

I have a datatable with re-order plugin (allowing the user to drag and drop rows) - and he can select the first 5 rows to get a prize.

He can select this 5 users with some order - like subscription order (simply using column order). Or he can order this 5 dinamically - with drag and drop, as he wish.

To show the TOP 5 i want to hightlight this rows

it's possible?

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @danielrodrigo ,

    There's a few ways you can go. If you just want it to be a one-off, you can just issue something like:

    $('tbody tr:lt(5)').css('color', 'red')
    

    If you want the top 5 rows to be highlighted all the time, you could add the colouring into drawCallback,

    Cheers,

    Colin

This discussion has been closed.