Natural sort with "aoColumns" disable the chance of ordering by that column
Natural sort with "aoColumns" disable the chance of ordering by that column
this is my code
[code]
$('#sorter').dataTable({
//disable sort on not important column
"aoColumnDefs": [{ "bSortable": false, "aTargets": [ 3,4 ] } ],
// disable default sorting
"aaSorting": [[0,'desc']]
});
[/code]
all works fine, but I see that my order my default column (by number) not work right (10, 2, 3, 4, 5...)
so i change the code above in this (searching into forum to find this solution)
[code]
$('#sorter').dataTable({
//disable sort on not important column
"aoColumnDefs": [{ "bSortable": false, "aTargets": [ 3,4 ] } ],
// disable default sorting
"aaSorting": [[0,'desc']],
"aoColumns": [
{ "sSortDataType": "dom-text", "sType": "numeric" },
{ "sSortDataType": "dom-text"},
{ "sSortDataType": "dom-text"},
{ "sSortDataType": "dom-text"},
{ "sSortDataType": "dom-text"},
]
});
[/code]
and It work great, my order now is (2, 3, 4...9, 10)
BUT if I click on Th of the column ordered by number nothing happens (ordering by all other columns still works). The code that brokes my order is "sType":"numeric"
but if I remove it I loose my natural sort..
the "arrow" change like that the ordering happens, but the ordering doesn't change from ASC to DESC and from DESC to ASC
someone can help me, please?
Thanks
[code]
$('#sorter').dataTable({
//disable sort on not important column
"aoColumnDefs": [{ "bSortable": false, "aTargets": [ 3,4 ] } ],
// disable default sorting
"aaSorting": [[0,'desc']]
});
[/code]
all works fine, but I see that my order my default column (by number) not work right (10, 2, 3, 4, 5...)
so i change the code above in this (searching into forum to find this solution)
[code]
$('#sorter').dataTable({
//disable sort on not important column
"aoColumnDefs": [{ "bSortable": false, "aTargets": [ 3,4 ] } ],
// disable default sorting
"aaSorting": [[0,'desc']],
"aoColumns": [
{ "sSortDataType": "dom-text", "sType": "numeric" },
{ "sSortDataType": "dom-text"},
{ "sSortDataType": "dom-text"},
{ "sSortDataType": "dom-text"},
{ "sSortDataType": "dom-text"},
]
});
[/code]
and It work great, my order now is (2, 3, 4...9, 10)
BUT if I click on Th of the column ordered by number nothing happens (ordering by all other columns still works). The code that brokes my order is "sType":"numeric"
but if I remove it I loose my natural sort..
the "arrow" change like that the ordering happens, but the ordering doesn't change from ASC to DESC and from DESC to ASC
someone can help me, please?
Thanks
This discussion has been closed.
Replies
If I leave aoColumns it works right, but the click on row TH doesn't change order from DESC/ASC
How I have to change my code to have right order (2,3,4..10 or 10, 9 , 8 ...2) but also have che click on TH working?
http://www.datatables.net/forums/discussion/47/natural-sort/p1