From 1c7ea33817ee2e5aebb3a59a5834a8ebc43b97e6 Mon Sep 17 00:00:00 2001 From: Rene Hrdina Date: Wed, 18 Nov 2020 15:37:08 +0100 Subject: [PATCH] Allow to disable actions on a per-row (per-record) basis When adding actions to a dataGrid the `condition` key can be specified. It can hold a function which currently doesn't receive any parameters. When we pass the record here we allow developers to decide whether or not to show a action on a per-row (per-record) basis, so showing an action for some items, hiding it for others. --- packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php b/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php index 6e48f0526..962bf7811 100644 --- a/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php +++ b/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php @@ -43,7 +43,7 @@
@foreach ($actions as $action) @php - $toDisplay = (isset($action['condition']) && gettype($action['condition']) == 'object') ? $action['condition']() : true; + $toDisplay = (isset($action['condition']) && gettype($action['condition']) == 'object') ? $action['condition']($record) : true; @endphp @if ($toDisplay)