bStateSave and sorting desc bug
bStateSave and sorting desc bug
zaksmok
Posts: 2Questions: 0Answers: 0
Hello. I have to say that DataTable is brilliant! Unfortunately I have problem with bStateSave and sorting desc. The state doesn't save. Pagination, filter and sorting asc working great, when I'm sorting DESC, the state is omitted.
My code is:
[code]
$('table').dataTable({
"bStateSave": true,
"bSortClasses": false,
"sPaginationType": "full_numbers"
});
[/code]
My code is:
[code]
$('table').dataTable({
"bStateSave": true,
"bSortClasses": false,
"sPaginationType": "full_numbers"
});
[/code]
This discussion has been closed.
Replies
Unfortunately it looks like you've found a bug in the latest release! Sorry about that. I've got a fix and will release it in a new version sometime soon. I can give you the source if you want to make the change in your current version if you like.
Regards,
Allan
Allan
in the method _fnAddColumn oSettings.aoColumns[oSettings.aoColumns.length++] = { "asSorting":
is always set to [asc, desc].
I tried to modify this value depending on the cookie value by creating the method (activable)
[code]
function _getSortColumn(oSettings, index, active) {
var out;
if (active) {
for (var j = 0; j < oSettings.aaSorting.length; j++) {
if (oSettings.aaSorting[j][0] == index) {
out = new Array(oSettings.aaSorting[j][1]);
} else {
out = new Array("asc", "desc");
}
}
} else {
out = new Array("asc", "desc");
}
return out;
}
[/code]
and inseting it
[code]
function _fnAddColumn(oSettings, oOptions, nTh) {
var iLengthTemp = oSettings.aoColumns.length;
var asSortingTemp = _getSortColumn(oSettings, iLengthTemp, true);
oSettings.aoColumns[oSettings.aoColumns.length++] = {
"sType": null,
"_bAutoType": true,
"bVisible": true,
"bSearchable": true,
"bSortable": true,
"asSorting": asSortingTemp,
....
[/code]
but with partial results...
Anyone have other ideas?
Fab
Allan