mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
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:
parent
1560bad60c
commit
01d376f501
@ -1418,8 +1418,12 @@ class MSSQLDatabase extends SS_Database {
|
||||
$objects = array();
|
||||
foreach ($result as $row) {
|
||||
$current++;
|
||||
|
||||
// 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);
|
||||
else $results = new ArrayList();
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user