To Use Action of a Grid Backend Magento 2 with Custom Code, you need to follow these steps:
- Step 1: Create a grid Magento 2
- Step 2: Set Id for this grid
- Step 3: Create a template file with url
- Step 4: Get grid object name of the grid
- Step 6: Use some function
You may know How to Code Inline Editing Grid in Magento 2 Backend in the previous post. In this post, we will find How to Use Action of a Grid Backend Magento 2 with Custom Code . In Magento 1, it is so easy to create a grid show data in backend and Magento 2 is so similar. Only with some part , you may create a grid to show data from a table easily. However, Magento 2 gives you two ways to create a grid in backend. Today I will help you Use Action of a Grid Backend Magento 2 with Custom Code with simple way .
If you want to use some action of grid Magento 2 backend, you can follow this guide to do it.
Use Action of a Grid Backend Magento 2 with Custom Code
Step 1 :
I created a grid Magento 2 like this.
In this grid, I set Id for this grid in _construct function.
protected function _construct()
I create a template file with url
In this template I get grid object name of the grid
$gridJsObjectName = $blockGrid->getJsObjectName();
var gridJsObject = window[‘<?php echo $gridJsObjectName ?>’],
gridJsObject .doFilter(); gridJsObject .reload();
The 6 steps I mention above is the shortest process for you to Use Action of a Grid Backend Magento 2 with Custom Code. Hope all you guys can learn Magento 2 easier with our series lesson. With this guide, you can manage the Grid Backend Magento 2 easily. Every store has a Grid Backend Magento 2 with many attributes.
Thank you for reading this post. Good luck!