Merge branch 'ManyManyRelationOrdering' of git://github.com/dnadesign/silverstripe-gridfieldextensions

* 'ManyManyRelationOrdering' of git://github.com/dnadesign/silverstripe-gridfieldextensions:
  fixed many many ordering so that other many many lists with the same relation aren't affected
This commit is contained in:
John Milmine 2014-05-26 16:13:39 +12:00
commit 2f67044ea9
1 changed files with 3 additions and 1 deletions

View File

@ -280,9 +280,11 @@ class GridFieldOrderableRows extends RequestHandler implements
if($list instanceof ManyManyList) {
$extra = $list->getExtraFields();
$key = $list->getLocalKey();
$foreignKey = $list->getForeignKey();
$foreignID = '= ' . (int) $list->getForeignID();
if(array_key_exists($this->getSortField(), $extra)) {
return sprintf('"%s" %s', $key, $value);
return sprintf('"%s" %s AND "%s" %s', $key, $value, $foreignKey, $foreignID);
}
}