Sri
Sri

Reputation: 1217

datatables hidden column date sorting

I have following string date column in datatables. I need to sort the table data onload based on the following column

enter image description here

Thank you, Sri

Upvotes: 1

Views: 74

Answers (1)

user3410846
user3410846

Reputation: 97

This is how you do initial sorting in DataTables:

$(document).ready(function() {
    $('#example').DataTable( {
        "order": [[ 3, "desc" ]]
    } );
} );

There should be a default date sort but here you could find some helpful plugins that will do the job if it is not working as intended:

https://www.datatables.net/plug-ins/sorting/

Upvotes: 1

Related Questions