How to highlight 3 highest values from every column in a table

How to highlight 3 highest values from every column in a table

thijzthijz Posts: 1Questions: 1Answers: 0

Hello,

We've a table with around 500 rows containing the following columns:

name [text]
goals [numeric]
assists [numeric]
passes [numeric]
crosses [numeric]
dribbles [numeric]

The table can be ordered by every column.

We would like to highlight every 3 highest numeric values for every column when filling the table with data. Even if we then orer the columns, those 3 highest values for every column needs to be stay highlighted.

I've made an example in Excel to show what we would expect doing above action. I've used position 1 as gold, position 2 as silver and position 3 as bronze.

We prefer doing this when initialising the table. Been looking around at the examples and documentation, but didn't find a clear solution for this.

My question: What would be the best way to do this?

If anyone could give us a push in the right direction, on which call or action you should use that would be very helpfull.

Many thanks.
Thij

Answers

  • colincolin Posts: 15,151Questions: 1Answers: 2,587

    That was a fun Friday afternoon challange - here you go: http://live.datatables.net/teqebezo/1/edit

    You'll want to check to make sure there are three unique colours in the code that does the colouring, but otherwise, that should be good to go,

    Colin

This discussion has been closed.