Disable sorting on first column
Disable sorting on first column
Hi there!
I am using the Tablepress Wordpress plugin and would like to include an extra option. I want to disable sorting in the first column and keep the sorting active on the other columns.
I inserted the following code in the "custom Commands" in the editing mode of the table with id 'top10'.
$('#top10').dataTable( {
"columnDefs": [
{ "orderable": false, "targets": 0 }
]
} );
When saving this, I loose all the sorting options of all column however.
Any suggestion to get this working?
Sorry for the beginner question, but I really can't get it working after reading and trying out different options for 2 hours,
Answers
Hi @geckoroutes ,
That's the correct syntax, see here. If it's a WordPress plugin, it might be worth contacting the author.
Cheers,
Colin
Thanks for the comment. I already solved it by leaving out the first row with the table name.
This code worked for me:
"columnDefs": [
{ "orderable": false, "targets": 0 }
]