sSortDataType cannot sort when value='default'
sSortDataType cannot sort when value='default'
nicsoft
Posts: 37Questions: 0Answers: 0
I am trying to sort a column with select elements. I have defined {"sSortDataType": "dom-select"} for that column.
I have two other columns that has select elements and is defined in the same way, for those it works without problem.
For each row in the select column that doesn't sort, I have value='default' for one option in each select element. After some testing I believe (tho not 100% confirmed yet) that the problem is due to the fact that I do have value='default' in my elements.
Can someone confirm that it is incorrect to set value='default', or is it supposed to work?
I have two other columns that has select elements and is defined in the same way, for those it works without problem.
For each row in the select column that doesn't sort, I have value='default' for one option in each select element. After some testing I believe (tho not 100% confirmed yet) that the problem is due to the fact that I do have value='default' in my elements.
Can someone confirm that it is incorrect to set value='default', or is it supposed to work?
This discussion has been closed.
Replies
> For each row in the select column that doesn't sort
All rows in DataTables must be sortable of the column is. The row position cannot be fixed. A column can be disabled from allowing sorting on it, but if it is sorted, then all information in that column will be sorted upon, moving rows as needed.
Perhaps you can link us to your page please?
Allan
The only thing I know is that I used different kind of values (some kind of ID) instead of default value of the selected option and then it worked. Unfortunately, I cannot share a link just yet, it's under development and the goal environment isn't up'n running yet (i.e. I have nowhere to put it...). But the cell looked like this when not sorting correctly:
[code]
Karoline Ingmarsson (karin)
Karin Andersson (kaand)
Anders And (stig)
-
[/code]
Of course, sometimes when one has a problem, one do some things to fix it and it starts to work. The actual reason why it started to work again could have been any other reasons, e.g. a missing ' came to place without thinking about it (but I checked carefully...). However, I only remember changing the value to something else but 'default'.
Niklas
D
C
B
A
-
-
-
But when changing back and having some kind of id as value, the sorting is like this:
A
B
C
D
-
-
-
I'm still happy because it sorts as I want. But I do feel like value='default' does something at least. Is the sorting utilizing the 'value' in some way? When having value='default' for one option, I do mix types since the rest of the options are having som kind of INT as value.
Basically what should be happening is that DataTables will take the currently selected value (regardless of if it is "default" or anything else) and then sort it with all the other selected values.
Allan