mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Merge pull request #95 from SilbinaryWolf/master
Fix bug where the current sort value is pulled from the base table if…
This commit is contained in:
commit
0e3b6318e6
@ -238,7 +238,25 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
$this->populateSortValues($items);
|
||||
|
||||
// Generate the current sort values.
|
||||
if ($items instanceof ManyManyList)
|
||||
{
|
||||
$current = array();
|
||||
foreach ($items->toArray() as $record)
|
||||
{
|
||||
// NOTE: _SortColumn0 is the first ->sort() field
|
||||
// used by SS when functions are detected in a SELECT
|
||||
// or CASE WHEN.
|
||||
if (isset($record->_SortColumn0)) {
|
||||
$current[$record->ID] = $record->_SortColumn0;
|
||||
} else {
|
||||
$current[$record->ID] = $record->$field;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$current = $items->map('ID', $field)->toArray();
|
||||
}
|
||||
|
||||
// Perform the actual re-ordering.
|
||||
$this->reorderItems($list, $current, $ids);
|
||||
|
Loading…
Reference in New Issue
Block a user