Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
how to properly sort a column that shows value as string but based on integer rank in datatable?

I am using datable to sort my table of a column called rank. Now my rank is represented as integer (1-4) in the database. So for example, I have rank 1 that is Bronze, rank 2 that is Silver, rank 3 that is Gold and rank 4 that is Platinum. The highest rank is platinum. So I want it to display on the table that shows the order from highest rank to lowest.

On my script I would write something like below:

$("#report").DataTable({
                "searching": false,
                "pageLength": 25,
                "processing": true,
                "order": [2, 'desc'],
                dom: "lBfrtip"
            });

This would not display in the right order as the datatable is sorting the column based on alphabetically. So my column will output the order like:

Silver
Platinum
Gold
Bronze

I want it to be:

Platinum
Gold
Silver
Bronze

Is it possible to modify this to make it to work (without modifying the server side script)?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!