Is there a way to add a ranking column to a html table of numbers?
Is there a way to add a ranking column to a html table of numbers?
Jeff A
Posts: 50Questions: 8Answers: 0
Hi, Is there a way to add a ranking column to a html table of numbers? I'm trying to replicate a table that was created in Excel using Excel's Rank() function. Anyone know if this can be done using DataTables? I already have the numbers in html page. See two attachments.
This discussion has been closed.
Answers
What does Excel's Rank() do?
Also, what is your data source - are you somehow importing from Excel, or using a database, or what? I ask because a database is likely to have a corresponding method of its own.
RANK: Returns the rank of a number in a list of numbers. The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.)
our software where we build reports doesn't have such a function.
Anyone have any suggestions?
Took up the challenge. Used the code in the 2nd post here to calculate the ranking. Did not validate the accuracy of that code. Will leave that to you
Used
drawCallback
to calculate the ranking. Basically the function gets an array of column 3 (extn) values then ranks them into another array. Then it loops through each row and saves the ranked array into column 4.Here is the code:
http://live.datatables.net/bexupefa/1/edit
thanks so much!!!. I will try this out..
Hi! I've been looking for the code for years now. Thank you so much.
Is there a way to get the reverse ranking of the "extn" column? The lowest number is the rank #1 ?
@moik See the other thread you commented on