Initial sorting with ordering is false
Initial sorting with ordering is false
Murphy013
Posts: 15Questions: 5Answers: 1
I wanna define an initial sorting for a table where the user have no possibility to change sorting.
I tried
var dtable = $('#tableData').DataTable({
ordering: false,
order: [ [ 2, 'asc' ],[ 0, 'asc' ] ],
and of course there is no sorting because ordering is switched off.
I also tried to disable sorting with
{ visible: true ,
orderable: false,
but the first column still shows a sort button.
Is there a way to do an initial sorting without the possibility for the user to change oredering?
regards
This question has accepted answers - jump to:
Answers
Not sure what the code snippet you posted applies to. Are you using
columnDefs.targets
set to_all
?The sort buttons will always show if the column is being sorted. As you show the
columns.orderable
is the option to use to turn off the user's ability to sort the column(s). Here is an example:http://live.datatables.net/qepirahi/1/edit
Kevin
Hi Kevin,
thanks for your example. I still see the sort buttons for the 2 columns which are used for initiail sorting. As I understood they are shown because they are used for initial sorting.
Is it possible to hide them that the user will not see them? In my case I have a filter table and a datatable which doesn't have colheaders. So it looks ugly.
Have a look here: http://live.datatables.net/bepehuku/1/edit
Regards
Generally you can make changes to Datatables styling by inspecting the component then overriding the CSS. The sorting image looks like this:
Add this CSS to hide the image:
http://live.datatables.net/gefuhaki/1/edit
Kevin