Sorted by default + not clickable columns
Sorted by default + not clickable columns
Hi Allan,
I'm confused about if my needing is possible.
I'm using "aaSortingFixed": [[ 3, "desc" ]], because I want to have my rows initially ordered by default.
I don't want that users could resort my datatable, that's why I'm using aaSortingFixed.
I'm confused in following point:
I don't understand why users can click on any column header.
I understand that I'm using aaSortingFixed because i don't want to allow users to click on headers.
Is there any way to have the datatables sorted by default (like using aaSortingFixed) and don't allow the users to click on column headers (like using bSort:false) ?
Thanks for this enjoyable plug-in.
Ricard
I'm confused about if my needing is possible.
I'm using "aaSortingFixed": [[ 3, "desc" ]], because I want to have my rows initially ordered by default.
I don't want that users could resort my datatable, that's why I'm using aaSortingFixed.
I'm confused in following point:
I don't understand why users can click on any column header.
I understand that I'm using aaSortingFixed because i don't want to allow users to click on headers.
Is there any way to have the datatables sorted by default (like using aaSortingFixed) and don't allow the users to click on column headers (like using bSort:false) ?
Thanks for this enjoyable plug-in.
Ricard
This discussion has been closed.
Replies
If you don't want to allow the user to do any sorting you can simply unbind the click event handler from the TH elements once the table has been initialised:
[code]
$('#example thead th').unbind('click');
[/code]
An alternative is to set all columns to "bSortable": false - that will stop the click event handler being added to the table.
[code]
"aoColumnDefs": [ { "bSortable": false, "aTargets": [ "_all" ] } ]
[/code]
That this latter one can be done could almost be considered a bug... but useful here :-)
Allan
First option (to unbind the click event handler) it's perfect for my case.
Thanks for your help
Ricard