Bug in paging for initialy 25 records per page
Bug in paging for initialy 25 records per page
![gomilos](https://secure.gravatar.com/avatar/80edd856aa9a6fb3acf014de31225ad9/?default=https%3A%2F%2Fvanillicon.com%2F80edd856aa9a6fb3acf014de31225ad9_200.png&rating=g&size=120)
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.
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.
This discussion has been closed.
Replies
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]
Allan
:)