How sort table using a link outside the table ?
How sort table using a link outside the table ?
svetlan@
Posts: 3Questions: 1Answers: 0
I need your help to solve such a problem. I need to sort my table using a link outside the table, not headers of the table (<th>). And headers of the table must be unsortable (disable sort function). How can I do this? Maybe, someone has faced with such task. Thank you,
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Use the
order()
method to order the table via the API. Usecolumns.orderable
to disable user ordering of the column headers.Allan
Thank you! It works)
May I ask you one more question?
How can I diasable default sorting when loading my page?
Now I have my table sorted at once by 1 column, but I need begin sorting only when user click the link.
My code:
var table = $('.datatable').DataTable({
"paging": false,
"searching": false,
"info": false,
"columnDefs": [
{ "orderable": false, "targets": [0, 1, 2, 3]}
]
});
});
Oh, I'm sorry. I find it by myself))
Just added
"order": []