Skip to content

Commit 600ae4b

Browse files
committed
Merge pull request #75 from briceburg/editable-relfields
support and cast relationship references as ReadonlyField
2 parents 187fa61 + c7fb5a5 commit 600ae4b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

code/GridFieldEditableColumns.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public function getColumnContent($grid, $record, $col) {
3030

3131
$fields = $this->getForm($grid, $record)->Fields();
3232
$value = $grid->getDataFieldValue($record, $col);
33-
$field = clone $fields->fieldByName($col);
33+
$rel = (strpos($col,'.') === false); // field references a relation value
34+
$field = ($rel) ? clone $fields->fieldByName($col) : new ReadonlyField($col);
3435

3536
if(!$field) {
3637
throw new Exception("Could not find the field '$col'");

0 commit comments

Comments
 (0)