Merge pull request #136 from jonom/fix-click-rows

FIX clickable editable rows
This commit is contained in:
Marcus 2016-03-31 13:36:57 +11:00
commit 84cf612582
2 changed files with 9 additions and 3 deletions

View File

@ -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); $fields->push($field);
} }

View File

@ -165,9 +165,12 @@
* GridFieldEditableColumns * GridFieldEditableColumns
*/ */
$('.ss-gridfield.ss-gridfield-editable .ss-gridfield-item').entwine({ $('.ss-gridfield.ss-gridfield-editable .ss-gridfield-item td').entwine({
onclick: function() { onclick: function(e) {
// Stop the default click action when fields are clicked on. // Prevent the default row click action when clicking a cell that contains a field
if (this.find('.editable-column-field').length) {
e.stopPropagation();
}
} }
}); });