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:19 +12:00
parent 45eb7954a6
commit d983768165

View File

@ -278,9 +278,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);
}
}