diff --git a/code/GridFieldEditableColumns.php b/code/GridFieldEditableColumns.php index aee407f..3abeac7 100644 --- a/code/GridFieldEditableColumns.php +++ b/code/GridFieldEditableColumns.php @@ -218,6 +218,9 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements )); } + // Add CSS class for interactive fields + if (!($field->isReadOnly() || $field instanceof LiteralField)) $field->addExtraClass('editable-column-field'); + $fields->push($field); } diff --git a/javascript/GridFieldExtensions.js b/javascript/GridFieldExtensions.js index 2a07d26..182fc6e 100644 --- a/javascript/GridFieldExtensions.js +++ b/javascript/GridFieldExtensions.js @@ -165,9 +165,12 @@ * GridFieldEditableColumns */ - $('.ss-gridfield.ss-gridfield-editable .ss-gridfield-item').entwine({ - onclick: function() { - // Stop the default click action when fields are clicked on. + $('.ss-gridfield.ss-gridfield-editable .ss-gridfield-item td').entwine({ + onclick: function(e) { + // Prevent the default row click action when clicking a cell that contains a field + if (this.find('.editable-column-field').length) { + e.stopPropagation(); + } } });