Grid Magento 2:在管理区域中显示多个网格
我已经以网格格式显示了我的一个自定义表。现在,我想以网格格式显示另一个自定义表(在不同的菜单下)。但是我有点困惑,如何在Grid Magento 2:在管理区域中显示多个网格,grid,magento2,Grid,Magento2,我已经以网格格式显示了我的一个自定义表。现在,我想以网格格式显示另一个自定义表(在不同的菜单下)。但是我有点困惑,如何在di.xml文件中添加代码。 以下是我为第一个网格创建的di.xml: app/code/Ved/Mymodule/etc/di.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLoc
di.xml
文件中添加代码。
以下是我为第一个网格创建的di.xml:
app/code/Ved/Mymodule/etc/di.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="Ved\Mymodule\Model\ResourceModel\News\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">ved_zipcodes</argument> <!-- here ved_zipcodes this is the db table name -->
<argument name="resourceModel" xsi:type="string">Ved\Mymodule\Model\ResourceModel\News</argument> <!-- Path -->
</arguments>
</virtualType>
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<!-- Here name value, we will use in mymodule_my_grid.xml layout file -->
<item name="mymodule_news_grid_data_source" xsi:type="string">Ved\Mymodule\Model\ResourceModel\News\Collection</item> <!-- Collection path -->
</argument>
</arguments>
</type>
</config>
维德乌兹普克兹
Ved\Mymodule\Model\ResourceModel\News
Ved\Mymodule\Model\ResourceModel\News\Collection
我应该如何更新di.xml以在admin中显示第二个网格?br 任何帮助都将不胜感激。多谢各位