Custom sort for String with 3 set of values in datatables

Custom sort for String with 3 set of values in datatables

SujitJSujitJ Posts: 19Questions: 8Answers: 0

I have used datables on one of my html tables. There are multiple columns currenltly in it. The last column in it can contain one of the below three values:
1.Amber
2.Pending
3.Red

So what i ideally want is, when the table is shown on page the data should be sorted alphabetically based on data in first column as well as data in last column (i.e Pending, Amber and then Red).

JS code:
$(document).ready(function() {
$('#violationTable').DataTable();
});

The data in table is popluated in jsp based on the values passed from servlet.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,815Questions: 1Answers: 10,517 Site admin
    Answer ✓

    Sounds like you want the columns.orderData option which can be used to trigger multi-column sorting from a single column.

    Allan

This discussion has been closed.