bStateSave not working in v1.7.2

bStateSave not working in v1.7.2

jeffreyjeffrey Posts: 16Questions: 0Answers: 0
edited September 2010 in Bug reports
Just noticed that "bStateSave": true, doesn't work in version 1.7.2. The last version that I noticed it worked with is 1.6.2. Has this been replaced with something new?

Thanks.

Replies

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Seems to work okay in the example with 1.7.2: http://datatables.net/examples/basic_init/state_save.html . Perhaps you can post a link to example which doesn't work please?

    Allan
  • jeffreyjeffrey Posts: 16Questions: 0Answers: 0
    In v1.6.2, "aaSorting": [], together with "bStateSave": true will work. But in v1.7.2 if I include aaSorting empty together with bStateSave true, then state save will not work.
  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Hi jeffrey,

    Thanks very much for the details. You are quite correct - I inadvertently introduced a bug in the 1.7 series which causes state saving to fail when aaSorting is empty. I've just committed a fix for this and a couple of unit tests to make sure it doesn't happen again! This will be part of DataTables 1.7.3 which I hope to release is the near future (within the next day).

    Regards,
    Allan
  • sipdudesipdude Posts: 1Questions: 0Answers: 0
    edited November 2010
    Hello!

    I'm having a similar issue as Jeffrey but with version 1.7.4. Let me explain:

    I have a single table on page "/index.php" with aaSorting and bStateSave and
    another table on page "/foo/index.php" with the same options enabled. The
    problem is that the sorting options from the first page ("/index.php") override
    the sort options on the other (they are not the same), *if* I link to it using the
    URL "/foo/index.php" but not when linking to the other page using only "/foo/" (ie
    without "index.php"). If it's of some help, the /foo/ table is generated using ajax,
    the table on the first page is not.

    I'm using jQuery version 1.7.2 as there are some issues with the latest version and
    the plugins I'm using.

    I'm experiencing the same issue with the latest versions of MSIE, Firefox, Chrome
    and Safari.

    This is the init for /index.php
    [code]
    var dynTable;
    $("#dynindex").ready(function(){
    /* init table */
    dynTable = $('#dynindex').dataTable({
    "oLanguage": {
    "sUrl": "/shared/static/js/i18n/LOCALE.txt"
    },
    "sPaginationType": "four_button",
    "bStateSave": true,
    "aaSorting": [[1,'desc']],
    "aoColumns": [
    { "bSearchable": true },
    { "bSearchable": false },
    { "bSearchable": false },
    { "bSearchable": false },
    { "bSearchable": false, "bSortable": false }
    ],
    "sDom": '<"headRight"lp>rt<"footLeft"f><"footRight"i>'
    });
    $("#dynindex_filter input").focus();
    var cWidth = $("#page").width();
    var cHeight = $("#page").height();
    if (cWidth != 'null' && cHeight != 'null') {
    $(".dataTables_processing").css({
    "position": "absolute",
    "top": cHeight/2 + 16 + "px",
    "left": cWidth/2 - 32 + "px"
    });
    }
    });
    [/code]

    And this is the init for /foo/index.php
    [code]
    var dynTable;
    $("#dynindex").ready(function(){
    /* init table */
    dynTable = $('#dynindex').dataTable({
    "oLanguage": {
    "sUrl": "/shared/static/js/i18n/LOCALE.txt"
    },
    "sPaginationType": "four_button",
    "bStateSave": true,
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "ajax/index.php",
    "aaSorting": [[0,'asc']],
    "aoColumns": [
    { "bSearchable": true },
    { "bSearchable": true },
    { "bSearchable": true },
    { "bSearchable": true },
    { "bSearchable": false },
    { "bSearchable": false },
    { "bSearchable": false, "bSortable": false }
    ],
    "sDom": '<"headRight"lp>rt<"footLeft"f><"footRight"i>'
    });
    $("#dynindex_filter input").focus();
    var cWidth = $("#page").width();
    var cHeight = $("#page").height();
    if (cWidth != 'null' && cHeight != 'null') {
    $(".dataTables_processing").css({
    "position": "absolute",
    "top": cHeight/2 + 16 + "px",
    "left": cWidth/2 - 32 + "px"
    });
    }
    });
    [/code]

    [code]
    Edit 1: Add inits
    [/code]

    Thanks
    /SD
This discussion has been closed.