How to remove the sort icon as well as sort feature from the datatables?
How to remove the sort icon as well as sort feature from the datatables?
Hi,
I am using datatables 1.10.24.
I tried to disable the sorting by using "ordering": false,
but this is not working.
When I use "ordering": false, I get error
DataTables warning: table id=dataTable - Ajax error. For more information about this error, please see http://datatables.net/tn/7
In the browser console, there is error 503.
When I remove the "ordering": false line, the table works as expected.
I also tried other methods like "order": [] and others using css like https://stackoverflow.com/questions/20196397/remove-sorting-arrows-in-jquery-datatables but none of them is working.
I want to remove the sort icon as well as sort feature from the datatable. My data comes from database using ajax and java in the backend.
Replies
I'm going to need a test case showing the issue please. As you can see in this little mock up
ordering
is the correct parameter to use for what you want.Allan
Sounds like you have server side processing enabled and when you set
ordering false
your server script has an error and responds with 503 Service Unavailable. You will need to look t your server logs and debug the server script to find out why its responding with 503 Service Unavailable.Kevin
@kthorngren yes server side is enabled with the option "serverSide" : true, and the data is sent from backend as paginated Gson string. When I print the data from the backend it shows as expected in the IDE console but I cannot get it in the datatable when using "ordering": false. (even when I am using "ordering": false, I can print the data in the IDE console. It just does not show up in the datatable)
@allan I did not exactly understand how to show the test case. Do you mean you want to see the code? or the datatable options I have enabled?
Providing a test case is explained here:
https://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read#latest
Based on your first post your server is responding with a 503 error. Is that the error you saw when you followed the troubleshooting steps in the technote?
http://datatables.net/tn/7
You will need to see what the server is returning to the client, not just a print of the data, to start debugging the problem. If its a 503 then you will need to look at your server logs to determine why the server is returning a 503.
Kevin
If anyone else is looking for a solution for the same problem, I solved mine by using order: [0,0] in the datatable option, and sortable: false for every column inside columns:[]