Hi all,
I am developing a project based on silverstripe/framework
3.7.1. There
I use a ModelAdmin that by default does not show up deprecated
records (i.e. rows with SostituitoDaID
!= 0).
I added a flag to the search context to be able to get those records in
the GridField. Here is the relevant code:
class MyAdmin extends ModelAdmin
{
...
public function getSearchContext()
{
$context = parent::getSearchContext();
...
$context->getFields()->push(CheckboxField::create(
'q[Tutti]',
'Includi obsoleti'
));
...
return $context;
}
public function getList()
{
$list = parent::getList();
$params = $this->request->requestVar('q');
...
if (empty($params['Tutti'])) {
$list = $list->filter('SostituitoDaID', '0');
}
...
return $list;
}
}
All is working as expected apart the deletion of those deprecated
records. Deleting other records works without issues.
My workflow is:
- I flag the checkbox in the filter to show up the deprecated records
in the main GridField - I select the record, entering its ItemEditForm
- I press the
Delete
button and confirm it.
After that a wrong redirection is performed (the .cms-content-header
disappears and the .cms-content-fields
overflows), the filter is reset
and the record is not deleted.
Any pointer would be appreciated.