5 (100%) 1 vote

How to Add Mass Action in Admin Grid in Magento 2

Allow me to share your steps that you will adhere to in this How to Add Mass Action in Admin Grid in Magento 2:

  1. Step 1:Adminhtml layout file
  2. Step 2Add a massAction tag in UI component xml file
  3. Step 3:Create options for selection
  4. Step 4:Controller file

Magento 2 use UI component to add more items for admin grid: column, filter argument, paging… and mass action.

This topic will show you how to add “change status” mass action to custom admin grid.

There are 4 steps:

Step 1: Adminhtml layout file

Adminhtml layout file:

Step 2: Add a massAction tag in UI component xml file

Add a massAction tag in UI component xml file: app/code/Magestore/Rewardpoints/view/adminhtml/ui_component/rewardpoints_earningrates_listing.xml

Step 3: Create options for selection

Create options for selection:

     app/code/Magestore/Rewardpoints/Ui/Component/MassAction/Status/Options.php

Step 4: Controller file

Controller file: app/code/Magestore/Rewardpoints/Controller/Adminhtml/Earningrates/MassStatus.php

 

Debug Technique in Magento 2
How to Declare CLI Commands in Magento 2 Module