BUG Changes being detected on TreeMulti as values not sorted

This commit is contained in:
Luke Edwards 2018-09-18 13:24:55 +12:00
parent 270aba4007
commit db63f55fbb

View File

@ -103,7 +103,12 @@ class TreeMultiselectField extends TreeDropdownField
// cannot rely on $this->value as this could be a many-many relationship // cannot rely on $this->value as this could be a many-many relationship
$value = array_column($values, 'id'); $value = array_column($values, 'id');
$data['value'] = ($value) ? $value : 'unchanged'; if ($value) {
sort($value);
$data['value'] = $value;
} else {
$data['value'] = 'unchanged';
}
return $data; return $data;
} }
@ -182,6 +187,7 @@ class TreeMultiselectField extends TreeDropdownField
} }
$title = implode(", ", $titleArray); $title = implode(", ", $titleArray);
sort($idArray);
$value = implode(",", $idArray); $value = implode(",", $idArray);
} else { } else {
$title = $emptyTitle; $title = $emptyTitle;