Non-alphanumeric Sort?

Non-alphanumeric Sort?

dataBdataB Posts: 23Questions: 5Answers: 1

Is it possible to sort in a non-alphanumeric way? I have a "Priority" column with possible values of "High" "Medium" and "Low" that I would like to sort in that order. Alphabetic sort gives me High, Low, Medium.

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 21,449Questions: 26Answers: 4,975
    Answer ✓

    You can use Orthogonal Data to set this up. Please post back if you have any questions.

    Kevin

  • dataBdataB Posts: 23Questions: 5Answers: 1
    edited May 2018

    Thanks! Look like this should do exactly what I need:

    render: function (data, type, row) {
                        if ( type === 'display' || type === 'filter' ) {
                            if (data == "High") {
                                return '<span class="u-label g-rounded-3 g-bg-red g-mr-10 g-mb-15">High</span>'
                            } else if (data == "Medium") {
                                return '<span class="u-label g-rounded-3 g-bg-yellow g-mr-10 g-mb-15">Medium</span>'
                            } else {
                                return '<span class="u-label g-rounded-3 g-bg-blue g-mr-10 g-mb-15">Low</span>'
                            }
                        }
                        
                        if (data == "High") {
                            return 1
                        } else if (data == "Medium") {
                            return 2
                        } else {
                            return 3
                        }
                        
                    }
    
    
  • kthorngrenkthorngren Posts: 21,449Questions: 26Answers: 4,975
    Answer ✓

    You may or may not want to set the span for type filter. I suspect if you search for something like "red" it will filter all the "High" rows. But otherwise yes it looks good.

    Kevin

This discussion has been closed.