How to add default sort in server side proccessing

How to add default sort in server side proccessing

drycrushaderdrycrushader Posts: 2Questions: 1Answers: 0

Hi, please tell me how to add default sort in server side proccessing.
I use this script to init.

$('#datatablecategory').DataTable({
"processing": true,
"stateSave": true,
"serverSide": true,
"ajax": "datatable.php",
columns: [
{ data: "$.category_menu" },
{ data: "c.category_name" },
{ data: "c.category_slug" },
{ data: "c.category_view" }
],
"autoWidth": false
});

Now, I want to know how to sort by "c.category_created_date" (for example) if I dont display category_created_date at datatable?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,230Questions: 1Answers: 10,417 Site admin
    Answer ✓

    order. The default is column index 0, ascending.

    Allan

  • drycrushaderdrycrushader Posts: 2Questions: 1Answers: 0

    Thanks Allan for your respond.
    Now I found the solution, is to set the column into not visible.
    And yeah, I use "order" option after that.

    Once again. Thanks Allan.

This discussion has been closed.