Mag admin grid

From SocalApp Solutions Wiki
Revision as of 15:16, 17 May 2024 by Brian (talk | contribs)

How to Save Admin Grid in Magento 2

In this article, we will find how to create an Admin Grid in Magento 2 backend. As you know, Magento 2 Grid is a kind of table which listing the items in your database table and provide you some features like: sort, filter, delete, update item, etc. The helloWorld for this is the grid of products, grid of customer.

Magento 2 provide two ways to create Admin Grid: using layout and using component. In this guide we use UI Component.

To Create Admin Grid

  • Step 1: Create routes admin
  • Step 2: Create admin menu
  • Step 3: Create Controller
  • Step 4: Create Admin Grid using Component
  • Step 5: Create Admin Grid using Layout

1. Create routes admin

File: app/code/Mageplaza/HelloWorld/etc/adminhtml/routes.xml

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="admin"> <route id="mageplaza_helloworld" frontName="mageplaza_helloworld"> <module name="Mageplaza_HelloWorld"/> </route> </router> </config>

def quick_sort(arr):
	less = []
	pivot_list = []
	more = []
	if len(arr) <= 1:
		return arr
	else:
		pass


__tag: magento2 admin grid__