'Sonata Admin remove the batch column from list view
Symfony 2.3.25, SonataAdminBundle
If i remove the 'delete' route from my admin by
$collection->clearExcept(array('list'));
in configureRoutes I get no 'batch' column in List View, which is what I want.
But I need the 'delete' action.
When I configureRoutes:
$collection->clearExcept(array('list', 'delete'));
I get the 'batch' column back, which I do not want. I do not want any batch actions or batch columns or anything batch.
I do want a 'Delete' button per row in an Actions column, which I get.
How do I suppress the batch column in list view?
Solution 1:[1]
Update for year 2016+. Now you can customize batch actions by using:
configureBatchActions method inside your Admin class.
/**
* Allows you to customize batch actions.
*
* @param array $actions List of actions
*
* @return array
*/
protected function configureBatchActions($actions)
{
return $actions;
}
Solution 2:[2]
You also can use the following:
/**
* {@inheritdoc}
*/
public function configureBatchActions($actions)
{
if (isset($actions['delete'])) {
unset($actions['delete']);
}
return $actions;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mokk |
| Solution 2 | dotoree |
