@@ -12,14 +12,75 @@ The Admin grids are used to represent, filter and sort various data in Magento b
12
12
In this tutorial we will show you how to create a simple admin grid.
13
13
14
14
15
- ### 1. Create a module
15
+ ### 1. Create a backbone module
16
16
17
17
18
- Everything starts with a module. First choose your namespace (we will be using Goivvy_Grid ):
18
+ Everything starts with a module. First choose your namespace (we will be using Dev_Grid ):
19
19
20
20
21
21
``` console
22
- mkdir -p app/code/Goivvy /Grid/etc
22
+ mkdir -p app/code/Dev /Grid/etc
23
23
```
24
24
25
+ Here are required files to get started:
25
26
27
+
28
+ ` app/code/Dev/Grid/etc/module.xml ` :
29
+
30
+ ``` xml
31
+ <?xml version =" 1.0" ?>
32
+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:Module/etc/module.xsd" >
33
+ <module name =" Dev_Grid" setup_version =" 1.0.0" >
34
+ <sequence >
35
+ <module name =" Magento_Backend" />
36
+ <module name =" Magento_Ui" />
37
+ </sequence >
38
+ </module >
39
+ </config >
40
+ ```
41
+
42
+ ` app/code/Dev/Grid/registration.php ` :
43
+
44
+ ``` php
45
+ <?php
46
+ \Magento\Framework\Component\ComponentRegistrar::register(
47
+ \Magento\Framework\Component\ComponentRegistrar::MODULE,
48
+ 'Dev_Grid',
49
+ __DIR__
50
+ );
51
+ ```
52
+
53
+ ` app/code/Goivvy/Grid/etc/adminhtml/routes.xml ` :
54
+
55
+ ``` xml
56
+ <?xml version =" 1.0" ?>
57
+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:App/etc/routes.xsd" >
58
+ <router id =" admin" >
59
+ <route id =" dev_grid" frontName =" dev_grid" >
60
+ <module name =" Dev_Grid" before =" Magento_Backend" />
61
+ </route >
62
+ </router >
63
+ </config >
64
+ ```
65
+
66
+
67
+ ### 2. Define an admin grid
68
+
69
+
70
+ The grid will display a list of available categories.
71
+
72
+
73
+ The page layout file ` app/code/Dev/Grid/view/adminhtml/layout/dev_grid_index.xml ` :
74
+
75
+ ``` xml
76
+ <?xml version =" 1.0" ?>
77
+ <page xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:View/Layout/etc/page_configuration.xsd" >
78
+ <body >
79
+ <referenceContainer name =" content" >
80
+ <uiComponent name =" dev_grid_category_listing" />
81
+ </referenceContainer >
82
+ </body >
83
+ </page >
84
+ ```
85
+
86
+ UiComponent ` dev_grid_category_listing ` has to be defined separately in a file with the same name
0 commit comments