Datagrid Action Into Add Condition
-
Hi,
We want to overwrite datagrid action coloum as in admin module order listing page default
action is view but we want to add one more action here so we added that. But we want to also put condition here so if condition true then that action show otherwise not display. -
Hi @Shambhu
Create a datagrid (Order) in your package with your condition, then you need to override order index file, after overriding it, call your datagrid to render.
Using this way, you can show your datagrid.Read this one for overriding view - https://forums.bagisto.com/topic/111/how-to-override-the-admin-layout
Thanks
-
I will override the index file but how to add the status wise condition below this code.
$this->addAction([ 'type' => 'View', 'method' => 'GET', // use GET request only for redirect purposes 'route' => 'admin.sales.orders.view', 'icon' => 'icon eye-icon' ]); $this->addAction([ 'type' => 'View', 'method' => 'GET', // use GET request only for redirect purposes 'route' => 'admin.sales.orders.edit', 'icon' => 'icon eye-icon' ]);
-
Hi @Shambhu
Can add condition like this -
$this->addColumn([ 'index' => 'status', 'label' => trans('admin::app.status'), 'type' => 'boolean', 'searchable' => true, 'sortable' => true, 'filterable' => true, 'wrapper' => function($value) { if ($value->status == 1) return '<a href="' . route('admin.customer.edit', $row->customer_id) . '">' . $row->customer_name . '</a>'; else return 'In Active'; } ]);
You can add status condition here and can add route from here.
Thanks