Skip to content

Commit b6fb4e8

Browse files
committed
1 parent d8a187b commit b6fb4e8

File tree

1 file changed

+64
-3
lines changed

1 file changed

+64
-3
lines changed

src/guides/v2.3/extension-dev-guide/admin-grid.md

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,75 @@ The Admin grids are used to represent, filter and sort various data in Magento b
1212
In this tutorial we will show you how to create a simple admin grid.
1313

1414

15-
### 1. Create a module
15+
### 1. Create a backbone module
1616

1717

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):
1919

2020

2121
```console
22-
mkdir -p app/code/Goivvy/Grid/etc
22+
mkdir -p app/code/Dev/Grid/etc
2323
```
2424

25+
Here are required files to get started:
2526

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

Comments
 (0)