Student
Student

Reputation: 1863

How stop sorting firstime with jQuery DataTable Plugin

I am using jQuery DataTable Plugin for tables. I get sorted records from database and create HTML tables but jQuery datatable plugin resort it to first column.

For Example, I have following table.

Person( name, birthdate, memberSince )

I get records from database sorted by memberSince but jQuery datatable plugin resort it by name(first column in html table).

I just want that datatable plugin should not sort it initialy.

Thanks

Upvotes: 1

Views: 316

Answers (2)

Sky Yip
Sky Yip

Reputation: 1089

No initial order:

$('#example').dataTable( {
  "order": []
} );

Upvotes: 0

Ayman Safadi
Ayman Safadi

Reputation: 11552

You want to look into the aaSorting option.

Your call dataTable() call should look something like:

$('#example').dataTable( {
     "aaSorting": [[ 2, "asc" ]]
} );

Upvotes: 2

Related Questions