Title: How to remove sorting option from DataTables?
Tags: jquery-plugins;datatables
Question: I'm using DataTables plugin. I don't want to use the sorting option (to sort the columns in ASC or DESC order) which comes by default on each <thead&gt;. How can I remove that sorting icon?
Comment: Does this answer your question? [Disable sorting for a particular column in jQuery DataTables](https://stackoverflow.com/questions/3932587/disable-sorting-for-a-particular-column-in-jquery-datatables)

Here is the accepted answer: Very similar to @ravisolanki07 , it's just a different way to achieve this.
var oTable = $('#example').dataTable( {
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0, 1, 2, 3 ] },
{ "bSearchable": false, "aTargets": [ 0, 1, 2, 3 ] }
Comment for this answer: Thx for specifying indexes

Here is another answer: Simply you can use this
&quot;ordering&quot;: false,
Full Code:
$('#example').DataTable({
&quot;ordering&quot;: false,

Here is another answer: Old question but none of these answers worked for me since none of them prevented the sort on click and I didn't want to reinitialize, so I'll post my solution:
Basically, clone the header, removing the sorting class from the <th&gt; cells, insert clone after real header and hide the original. When you want to reenable, just reshow original header and remove clone.
This worked for my case, you may have to adjust the thead selector you use depending on your setup.
// grab the header
const stashedHeader = $('.dataTable thead');
// copy it and remove sorting class from the copy's th cells
const nosortClone = stashedHeader.clone();
nosortClone.find('th').removeClass('sorting');
// hide original and insert clone after it
stashedHeader.hide().after(nosortClone);
// re-enable
stashedHeader.show()
nosortClone.remove();

Here is another answer: You can e.g. set style="display:none;" to the arrow element. You can set it programmatically  using JavaScript or you can use CSS class. Firstly you have to examine the HTML code (the arrow element) using some developer console like FireBug.
Comment for this answer: yep. it probably wasn't at the time of my answer. :) then setting background-image property will do...

Here is another answer: There are 2 ways you can try.
First, try setting &quot;bSort&quot; to false.
Note that, this will disable sorting all around.
$('#jTable').dataTable({ &quot;bSort&quot; : false } );
Second, try setting aaSorting to empty.
Note that, this will remove sorting for specific column.
$('#jTable').dataTable({ &quot;aaSorting&quot; : [[]] });
Let us know if either works for you.
Hope it helps,
Kashif Solangi

Here is another answer: You can set it by bSortable to false in aocolumn like :
$('#example').dataTable({
"aoColumns": [
{ "sType": "html","bSortable": false, "bSearchable": false },
{ "sType": "html" },
{ "sType": "html", "bSortable": false, "bSearchable": false },
{ "sType": "html" },
{ "sType": "html","bSortable": false, "bSearchable": false },
{ "sType": "html" },
{ "sType": "html" },
{ "sType": "html" },
{ "sType": "date-euro" }
]
});
You can also exclude from search by set bSearchable to false

Here is another answer: Using the aoColumns attribute, sorting a specific column can be easily controlled. An example is given bellow:
$(document).ready(function() {
oTable = jQuery('#DataTables_Table_0').dataTable( {
"bDestroy": true,
"bAutoWidth": true,
"bFilter": true,
"bSort": true,
"aaSorting": [[0]],
"aoColumns": [
{ "bSortable": false },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": false }
]
} );

Here is another answer: In the new version 1.10 of jQuery DataTables you must use ordering option to disable ordering on the entire table:
$('#example').DataTable({
"ordering": false
Comment for this answer: I confirm this works in `angular 2+` also.  `dtOptions: DataTables.Settings {ordering: false,}`
Comment for this answer: I cannot see in the documentation that ordering *must* be used globally and that ordering does not disappear if it is set individually to all columns. However, the answer seems to be correct. If I set each column to `"ordering": false`, then the sort symbol remains on the first column, even if it doesn't work. At least for me (DataTables Version 1.10.20).

Here is another answer: Ok, so, the answers here are a bit old. So I thought I could provide e newer answer:
source documentation
As of 2018, the way to achieve this, per field, is:
$('#id-of-my-table').DataTable({
"columnDefs": [
{ "orderable": false, "targets": [0, 4, 5, 6] },
{ "orderable": true, "targets": [1, 2, 3] }
As you can see, targets accepts an array of column indexes.
Comment for this answer: This works for me. Just need to put orderable false. Thanks.
Comment for this answer: You can even omit the orderable true part and just state which ones to disable sorting on.

Here is another answer: -&gt;  for removing sorting in particular column then use orderable: false
-&gt;  for removing search from particular column then use searchable:
$('#table-name').DataTable({
&quot;columns&quot;: [
{&quot;data&quot;: &quot;column_name&quot;},
{&quot;data&quot;: &quot;column_name&quot; , orderable: false},
{&quot;data&quot;: &quot;column_name&quot;},
{&quot;data&quot;: &quot;column_name&quot; , orderable: false},
{&quot;data&quot;: &quot;action&quot;}
],
aoColumnDefs: [
{
bSortable: false,
aTargets: [ -1 ]
}
]
});

Here is another answer: You can also pass the option on the table itself using data attributes.
<table
data-paging=&quot;false&quot;
data-searching=&quot;false&quot;
data-ordering=&quot;false&quot;
The same principle applies to column headers.
<table&gt;
<thead&gt;
<tr&gt;
<th&gt;I'm sortable</th&gt;
<th data-orderable=&quot;false&quot;&gt;I'm not sortable</th&gt;
</tr&gt;
</thead&gt;
But, I came across a situation where I wanted to remove all columns sorting and realize that Datatable still adds the icon on the first column when using a th data-orderable=&quot;false&quot; on all columns, in that case, use the data-ordering on the table instead.
This can be handy should you use the same custom script to generate all your Datatables.

Here is another answer: If you want to disable the default sorting but keep the columns sortable, just use the following configuration :
$(document).ready( function() {
$('#example').dataTable({
"aaSorting": []
});
Comment for this answer: This is what I was searching for. tnx

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 12, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:05/02/13', 'FavoriteCount': 8.0, 'PostTypeId': 1, 'Tags': '<jquery-plugins><datatables>', 'Title': 'How to remove sorting option from DataTables?', 'ViewCount': 145854, 'id': 16335928, 'user_AboutMe': '<p>Inactive profile</p>\n<hr />\n<p><a href="https://stackexchange.com/users/94344"> <img src="https://stackexchange.com/users/flair/94344.png" width="208" height="58" alt="profile for Chankey Pathak on Stack Exchange, a network of free, community-driven Q&amp;A sites" title="profile for Chankey Pathak on Stack Exchange, a network of free, community-driven Q&amp;A sites"> </a></p>\n<p><strong>Project:</strong></p>\n<ul>\n<li><a href="https://tutswiki.com" rel="nofollow noreferrer">TutsWiki</a> - An open source platform to provide collaborative tutorials.</li>\n<li><a href="https://www.linuxstall.com" rel="nofollow noreferrer">LinuxStall</a> - A place for all your Linux needs.</li>\n</ul>\n<p><strong>Find me:</strong></p>\n<ul>\n<li><a href="https://plus.google.com/111047291269906896798" rel="nofollow noreferrer">Google+</a></li>\n<li><a href="http://www.twitter.com/chankeypathak" rel="nofollow noreferrer">Twitter</a></li>\n<li><a href="http://in.linkedin.com/in/chankeypathak" rel="nofollow noreferrer">LinkedIn</a></li>\n<li><a href="https://github.com/chankeypathak" rel="nofollow noreferrer">GitHub</a></li>\n</ul>\n<p><strong>Email:</strong> chankey@cpan.org</p>\n', 'user_AccountId': 94344.0, 'user_DisplayName': 'Chankey Pathak', 'user_Reputation': 20432.0, 'user_Views': 4031.0, 'user_id': 257635.0}}