Magento 2 creation of admin grid is quite different from Magento 1. In this article we will see how we can create Magento 2 admin grid. Admin Grids. As you are aware Magento 2 Grids are kind of table which lists the items of your database table and provide you some common features like sort, filter, delete, update item, etc. The below diagram show roughly the activities involved in creating admin grid. Further in the Article these all are described in detail. For the purpose of this article we will create simple Ticketing system admin grid which shows the support tickets created by customers (The next article covers where logged in customer can raise a ticket, and also see his previous created tickets in List)
- Create Module
- Define Admin routes
- Create entries in menu.xml to Display your custom menus in Admin Panel
- Create Controller
- Define Database schema through Installer
- Create Model
- Use admin Grid Components to Create Grid UI.
-
/Setup/Patch/Data/Revertable.php
//generate patch php bin/magento help setup:db-declaration:generate-patch php bin/magento setup:db-declaration:generate-patch Bdcrops_TicketingSystem Example --type=data php bin/magento setup:db-declaration:generate-patch Bdcrops_TicketingSystem Example --type=schema // whitelist php bin/magento setup:db-declaration:generate-whitelist [options] php bin/magento setup:db-declaration:generate-whitelist --module-name=vendor_module php bin/magento setup:db-declaration:generate-whitelist --module-name=Bdcrops_TicketingSystem php bin/magento setup:upgrade --dry-run=1 --keep-generated php bin/magento setup:upgrade
-
view/adminhtml/ui_component/ticketingsystem_tickets_listing.xml
-
view/adminhtml/ui_component/ticketingsystem_tickets_listing.xml