Allow dataless fields in inline add button

This commit is contained in:
mi3ll 2014-07-17 12:58:16 +10:00
parent 7bf3cf9a31
commit 3fc48b33ee

View File

@ -93,8 +93,7 @@ class GridFieldAddNewInlineButton implements GridField_HTMLProvider, GridField_S
$fields = $editable->getFields($grid, $record); $fields = $editable->getFields($grid, $record);
foreach($grid->getColumns() as $column) { foreach($grid->getColumns() as $column) {
if(in_array($column, $handled)) { if(in_array($column, $handled) && $field = $fields->fieldByName($column)) {
$field = $fields->dataFieldByName($column);
$field->setName(sprintf( $field->setName(sprintf(
'%s[%s][{%%=o.num%%}][%s]', $grid->getName(), __CLASS__, $field->getName() '%s[%s][{%%=o.num%%}][%s]', $grid->getName(), __CLASS__, $field->getName()
)); ));