Skip to content

Commit

Permalink
GridFieldOrderableRows: Prefix sort field with table name when sorting
Browse files Browse the repository at this point in the history
Prevents ambiguities when the GridField's underlying DataList uses a query
that joins multiple tables having a sort field.
  • Loading branch information
pief committed Feb 23, 2015
1 parent 4855ac5 commit ea637b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/GridFieldOrderableRows.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function getManipulatedData(GridField $grid, SS_List $list) {
$sortterm = $this->extraSortFields.', ';
}
}
$sortterm .= $this->getSortField();
$sortterm .= $this->getSortTable($list).'.'.$this->getSortField();
return $list->sort($sortterm);
} else {
return $list;
Expand Down Expand Up @@ -226,7 +226,7 @@ public function handleReorder($grid, $request) {
$sortterm = $this->extraSortFields.', ';
}
}
$sortterm .= $field;
$sortterm .= $this->getSortTable($list).'.'.$field;
$items = $list->filter('ID', $ids)->sort($sortterm);

// Ensure that each provided ID corresponded to an actual object.
Expand Down

0 comments on commit ea637b0

Please sign in to comment.