You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For gridfields with records that can only be viewed and deleted (not edited), there should be a delete button on the delete button on the GridFieldDetailForm. This has been fixed in the past, since the code specifically tries to solve this specific scenario. But the delete button is in a inactive state, so deleting is not possible for the user:
How to reproduce
Reproduction by creating a Model with canEdit = false and canDelete = true
And a page where the read-only gridfield is shown.
Care will have to be taken when fixing this that sudo mode still doesn't allow performing a delete action if the form is protected.
It would probably also make sense for the delete action to be disabled by default for a regular readonly GridFieldDetailForm and have to be enabled either at a project level or a gridfield level.
GuySartorelli
changed the title
Delete action not possible in GridFieldDetailForm when using RecordViewer
Delete action not possible in read-only GridFieldDetailForm
Feb 24, 2025
Module version(s) affected
5.3.0
Description
For gridfields with records that can only be viewed and deleted (not edited), there should be a delete button on the delete button on the GridFieldDetailForm. This has been fixed in the past, since the code specifically tries to solve this specific scenario. But the delete button is in a inactive state, so deleting is not possible for the user:
How to reproduce
Reproduction by creating a Model with
canEdit = false
andcanDelete = true
And a page where the read-only gridfield is shown.
ExampleModel.php
Page.php
Possible Solution
In the method ItemEditForm() there is a solution made for this specific scenario:
see
silverstripe-framework/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
Lines 265 to 271 in 5fa5a0c
But in the view()-method, where this ItemEditForm() is called, the ->makeReadOnly() seems to be undoing the effort:
see
silverstripe-framework/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
Lines 143 to 144 in 5fa5a0c
Validations
silverstripe/installer
(with any code examples you've provided)The text was updated successfully, but these errors were encountered: