Download as pdf
Download as pdf
You are on page 1of 2
Magento 2.3 - Admin Grid with Ui Component Module: Module_AdminGrid Url: admin > admingrid/customrule/index tree /F [== README .ma =~ app =+ code ~~ Module =~ Admingrid |-- Controller | -- Adminhtm | =~ CustomRule i = Index.php |-- Model, | [++ Customrule. php *-+ Resourcetodel |-- Customaule | “++ Collection. php = CustomRule. php acl.xml adminhtml [== menu. xm routes. xml db_schema. xml di. xml. module. xml. registration. php >-- adminhtml |-- layout | +++ admingrid_custonrule_index. xml + ui_component admingri | _customrule_listing.xml 16 directories, 14 files 1. Create index action layout file: view/adminhtml/layout/admingrid_customrule_index.xml 1.1) For the action, admingrid/custonrule/index, we will create a layout file name admingrid_customrule_index.xm1. 1.2) Here we will declare the uiComponent file for the content of grid page. htpsiigthub.corvnithinninarvmagento2-admin-gid- view 12 riz, 4.45 PM {GitHub - nthineninanimagento2-admin-gie-view: Magento 2.3 - Admin Grid with UI Component 2. Create Component layout file(Ui Component xm file): view/adminhtml/ui_component/admingrid_customrule_| xml 2.1) As declared in layout file, we will create a component file admingrid_customrule_listing.xml 2.2) Here we will declare the grid layout and call data source/data provider. 2.3) Toolbar: true 1) Paging(add pagination for the grid): Insert in ListToolbar 2) Export Button(export the data of the grid): Insert ‘export_button"/> in ListToolbar in ListToolbar 4) Column controls(add a columns list box which allow ‘the admin user can choose which columns can be shown up on grid) 3. Create dixml file: etc/dixml 3.1) Here we will declaring Resource model, which will connect to the model and fetch the data to ‘the custom Grid. Also it will declare the Grid Collection class, table and resource Model for the table. Note: declare(strict types=1); 1, Due to PHP7.2 and Magento 2.3 standards we have to use strict mode during development, so that means that for classes you need to add declare(strict_type: ds FAQ: Can we use this code in Production instance >>> Yes, Magento core, uses that mode as well. htpsiigthub.corvnithinninarvmagento2-admin-gid- view 22.

You might also like