Bug in paging for initialy 25 records per page

Bug in paging for initialy 25 records per page

gomilosgomilos Posts: 3Questions: 0Answers: 0
edited August 2010 in Bug reports
I found in _fnCalculateEnd in jquey.DataTables.js (also in new 1.7.1 version) bug.
When have initialy 25 records per page and set pagination, and get data from web service JSON and aobut 140 rows, after gate first page when i go to second in paging link line in _fnCalculateEnd function :
*oSettings._iDisplayStart + oSettings._iDisplayLength > oSettings.aiDisplay.length*
cause bug.

Where:
oSettings._iDisplayStart = "25"
oSettings._iDisplayLength = "025"
oSettings.aiDisplay.length = "140"
oSettings._iDisplayStart + oSettings._iDisplayLength = "2525"

When use parseInt for oSettings._iDisplayStart and oSettings._iDisplayLength, it is ok.

Replies

  • gomilosgomilos Posts: 3Questions: 0Answers: 0
    Sorry
    oSettings._iDisplayLength = "25"
    after click on "2" in pagination. Everything else is as i firstly wrote.

    When i do the fix, everything as ok:
    [code]
    function _fnCalculateEnd(oSettings) {
    if (oSettings.oFeatures.bPaginate === false) {
    oSettings._iDisplayEnd = oSettings.aiDisplay.length;
    }
    else {
    /* Set the end point of the display - based on how many elements there are
    * still to display
    */
    var _endDataRow = parseInt(oSettings._iDisplayStart) + parseInt(oSettings._iDisplayLength);
    // if (oSettings._iDisplayStart + oSettings._iDisplayLength > oSettings.aiDisplay.length ||
    if (_endDataRow > oSettings.aiDisplay.length || // added by Goran M.
    oSettings._iDisplayLength == -1) {
    oSettings._iDisplayEnd = oSettings.aiDisplay.length;
    }
    else {
    //oSettings._iDisplayEnd = oSettings._iDisplayStart + oSettings._iDisplayLength;
    oSettings._iDisplayEnd = _endDataRow;// added by Goran M.
    }
    }
    }
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    It looks like you are using strings rather than integers. If you just use numbers, rather than string, does everything not work okay?

    Allan
  • gomilosgomilos Posts: 3Questions: 0Answers: 0
    Yes you're right, i set string for that property from xml config file. I notice that in the evening. Thanx for you replay.
    :)
This discussion has been closed.