bStateSave and sorting desc bug

bStateSave and sorting desc bug

zaksmokzaksmok Posts: 2Questions: 0Answers: 0
edited February 2010 in Bug reports
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]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi zaksmok,

    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
  • zaksmokzaksmok Posts: 2Questions: 0Answers: 0
    Thanks for your reply. Yes it would be great if you can send me or write here the changes. Regards!
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Could you ping me a message using http://datatables.net/contact and I'll send you the development version.

    Allan
  • f.dalpozzof.dalpozzo Posts: 8Questions: 0Answers: 0
    I have the same problem,
    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
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yes - as noted a fix will be available in the next release. If you would like a copy of the development version (which is taking a while due to all the support requests!), please ping me using the above link.

    Allan
This discussion has been closed.