0

I am using datatable to show my data in a table and my code is like this:

$('#data_table').DataTable(data);

Right now i want to apply the properties "order": [] to the data table. I already tried below option but not working.

$('#data_table').DataTable( {
"order": [],
data:data,
} );
Gyrocode.com
  • 57,606
  • 14
  • 150
  • 185
user3172663
  • 312
  • 3
  • 14
  • What is not working? what are the errors you are getting? Which version of datatables are you using? Could you explain your question a bit further? – Sahan Serasinghe Jun 09 '17 at 06:10
  • I am using version DataTables 1.10.13 and the result showing No data available in table. – user3172663 Jun 09 '17 at 06:12
  • @SahanSerasinghe Here is the screenshot of the result i am getting.https://www.screencast.com/t/UevBAZrNwM2s but when i am using $('#data_table').DataTable(data); the table is coming fine with data – user3172663 Jun 09 '17 at 06:19

1 Answers1

0

You have to specify which columns you need to apply ordering and what order(asc or desc)

"order": [[ 0, "asc" ]], where 0 is for first column

in case you need more its

"order": [[ 0, "asc" ],[1 , "asc"]]
Rahul
  • 2,374
  • 2
  • 9
  • 17
  • I was looking to implement the following option.https://stackoverflow.com/questions/4964388/is-there-a-way-to-disable-initial-sorting-for-jquery-datatables – user3172663 Jun 09 '17 at 06:13