Added support for dot notation in GridField name

When you want to have a GridField for a sub-relation on a relation of your DataObject you use dot notation, this breaks the functionality of GridFieldOrderableRows because in the POST request the dot is replaced by an underscore.
This commit is contained in:
Luca Postiglione 2020-01-29 12:57:30 +01:00 committed by GitHub
parent 8e37021317
commit 4d94b2748d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -396,7 +396,12 @@ class GridFieldOrderableRows extends RequestHandler implements
}
// Get records from the `GridFieldEditableColumns` column
$data = $request->postVar($grid->getName());
$gridFieldName = $grid->getName();
if (strpos($gridFieldName, '.') !== false) {
$gridFieldName = str_replace('.', '_', $gridFieldName);
}
$data = $request->postVar($gridFieldName);
$sortedIDs = $this->getSortedIDs($data);
if (!$this->executeReorder($grid, $sortedIDs)) {
$this->httpError(400);