BUG Fixing problem where duplicate items appear on pages

Reverts 13cdb07539 and instead calls
setLimitItems(false) on PaginatedList to tell it we've already
limited the number of items to be shown.
This commit is contained in:
Sean Harvey 2013-05-27 15:21:24 +12:00
parent 1560bad60c
commit 01d376f501

View File

@ -1418,7 +1418,11 @@ class MSSQLDatabase extends SS_Database {
$objects = array();
foreach ($result as $row) {
$current++;
$objects[] = DataObject::get_by_id($row['Source'], $row['ID']);
// Select a subset for paging
if ($current >= $start && $current < $start + $pageLength) {
$objects[] = DataObject::get_by_id($row['Source'], $row['ID']);
}
}
if(isset($objects)) $results = new ArrayList($objects);
@ -1427,6 +1431,10 @@ class MSSQLDatabase extends SS_Database {
$list->setPageStart($start);
$list->setPageLength($pageLength);
$list->setTotalItems($current+1);
// The list has already been limited by the query above
$list->setLimitItems(false);
return $list;
}