bSortable: false not working on first column - 1.10
bSortable: false not working on first column - 1.10
karine
Posts: 4Questions: 0Answers: 0
I'm testing the upcoming version (1.10) and found some strange behaviour. I have a first column which I don't want to be sorted or searched. I have set my aoColumns like this:
[code]"aoColumns": [{bSearchable: false, bSortable: false},{sType: "html"},{sType: "html"},{sType: "html"},null,null,null][/code]
The first column will still get class sorting_asc. Doing some testing I tried setting the second column to bSortable: false, and that column gets the correct class sorting_disabled, so seems like it's only a problem with the first column.
Using 1.9.4 bSortable is working as I would expect.
Set up a small JSFiddle example: http://jsfiddle.net/karineh/gkTMu/
[code]"aoColumns": [{bSearchable: false, bSortable: false},{sType: "html"},{sType: "html"},{sType: "html"},null,null,null][/code]
The first column will still get class sorting_asc. Doing some testing I tried setting the second column to bSortable: false, and that column gets the correct class sorting_disabled, so seems like it's only a problem with the first column.
Using 1.9.4 bSortable is working as I would expect.
Set up a small JSFiddle example: http://jsfiddle.net/karineh/gkTMu/
This discussion has been closed.
Replies
However, if this behaviour has changed since 1.9.4 then either 1.9.4 was a bug, or this is unintended. I'll dig into it to find out which!
Allan
I've tried setting "aaSorting": [], as I don't want any initial sort, and it's working perfect in my jsfiddle example, but unfortunatly not at all in my working code. Still get sorting_asc on the first column.
I've tried to remove other datatables plugins and extensions as well to see if the problem could be there, but no luck.
As a quick fix I think I'll just remove the class after initializing the table.
That, I would say, is most certainly wrong. Either the column should not be sorted, or it should be sorted and the sorting class applied. DataTables 1.10 takes the second approach. The way the bSortable flag is seen is as an indication of user interaction - so using fnSort you can still sort a column which is makes as bSortable: false.
A little confusing I know, but the new documentation for 1.10 does state this fact. It is a tradeoff between flexibility and convenience, and I've gone for the flexible approach here.
Allan