• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

  • Register
  • Login
  • Search
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups

Datagrid Action Into Add Condition

General Discussion
2
4
981
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    Shambhu last edited by 5 Oct 2019, 09:50

    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.

    1 Reply Last reply Reply Quote 0
    • R
      rahul last edited by 5 Oct 2019, 11:07

      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

      1 Reply Last reply Reply Quote 0
      • S
        Shambhu last edited by 9 Oct 2019, 06:52

        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'
            ]);
        
        1 Reply Last reply Reply Quote 0
        • R
          rahul last edited by rahul 15 Oct 2019, 07:29 15 Oct 2019, 07:26

          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

          1 Reply Last reply Reply Quote 0
          1 out of 4
          • First post
            1/4
            Last post