Magento 2 : Display multiple grids in admin areaNot able to display grid in admin area of custom moduleHow to add filtering to custom table field column in Customers admin grid in Magento2?Magento 2: What's the Difference Between the Two Grid Component Data Providers?Magento 2: Duplicate key-sequence unique identity-constraint 'uniqueVirtualType' fatal error while di:compileFatal error: Call to undefined method MagentoFrameworkViewElementUiComponentDataProviderDataProvider::addField()Ui Template / Adminhtml issueAdminhtml Grid giving error Magento 2Want to like getCustomAttributes() to my own tableShipment grid custom mass action problem with UiComponentFactory::argumentsResolver()How to allow duplicate entries in admin grid

Extract an attribute value from XML

As a DM, how to avoid unconscious metagaming when dealing with a high AC character?

Replacements for swear words

Steampunk helicopter

<schwitz>, <zwinker> etc. Does German always use 2nd Person Singular Imperative verbs for emoticons? If so, why?

diff shows a file that does not exist

Keep milk (or milk alternative) for a day without a fridge

Is purchasing foreign currency before going abroad a losing proposition?

Password maker in c#

Why does resistance reduce when a conductive fabric is stretched?

Where or how can I find what interfaces an out of the box Apex class implements?

How the name "craqueuhhe" is read

Optimising Table wrapping over a Select

Identifying Lithuanian coordinate system?

Are there any intersection of Theory A and Theory B?

Was the Ford Model T black because of the speed black paint dries?

How to check the quality of an audio sample?

Are there any double stars that I can actually see orbit each other?

Bronze Age Underwater Civilization

Stuck Apple Mail - how to reset?

Was adding milk to tea started to reduce employee tea break time?

Cubic programming and beyond?

Credit union holding car note, refuses to provide details of how payments have been applied

Can I use "candidate" as a verb?



Magento 2 : Display multiple grids in admin area


Not able to display grid in admin area of custom moduleHow to add filtering to custom table field column in Customers admin grid in Magento2?Magento 2: What's the Difference Between the Two Grid Component Data Providers?Magento 2: Duplicate key-sequence unique identity-constraint 'uniqueVirtualType' fatal error while di:compileFatal error: Call to undefined method MagentoFrameworkViewElementUiComponentDataProviderDataProvider::addField()Ui Template / Adminhtml issueAdminhtml Grid giving error Magento 2Want to like getCustomAttributes() to my own tableShipment grid custom mass action problem with UiComponentFactory::argumentsResolver()How to allow duplicate entries in admin grid






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have displayed my one custom table in a grid format. Now, I want to display one other custom table in a grid format (Under different menu). But I am little bit confused, how to add code in di.xml file



Here is my di.xml which I have created for my first grid :

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="VedMymoduleModelResourceModelNewsCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
<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">VedMymoduleModelResourceModelNews</argument> <!-- Path -->
</arguments>
</virtualType>
<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<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">VedMymoduleModelResourceModelNewsCollection</item> <!-- Collection path -->
</argument>
</arguments>
</type>
</config>





How should I update my di.xml for displaying second grid in admin using the same custom module?



Any help would be highly appreciated. Thank you.










share|improve this question
























  • did you got any solution?

    – Piyush
    Jun 7 '17 at 13:18











  • No, I did not get. Let me know if you find anything.

    – vedu
    Jun 8 '17 at 5:15

















1















I have displayed my one custom table in a grid format. Now, I want to display one other custom table in a grid format (Under different menu). But I am little bit confused, how to add code in di.xml file



Here is my di.xml which I have created for my first grid :

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="VedMymoduleModelResourceModelNewsCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
<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">VedMymoduleModelResourceModelNews</argument> <!-- Path -->
</arguments>
</virtualType>
<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<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">VedMymoduleModelResourceModelNewsCollection</item> <!-- Collection path -->
</argument>
</arguments>
</type>
</config>





How should I update my di.xml for displaying second grid in admin using the same custom module?



Any help would be highly appreciated. Thank you.










share|improve this question
























  • did you got any solution?

    – Piyush
    Jun 7 '17 at 13:18











  • No, I did not get. Let me know if you find anything.

    – vedu
    Jun 8 '17 at 5:15













1












1








1








I have displayed my one custom table in a grid format. Now, I want to display one other custom table in a grid format (Under different menu). But I am little bit confused, how to add code in di.xml file



Here is my di.xml which I have created for my first grid :

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="VedMymoduleModelResourceModelNewsCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
<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">VedMymoduleModelResourceModelNews</argument> <!-- Path -->
</arguments>
</virtualType>
<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<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">VedMymoduleModelResourceModelNewsCollection</item> <!-- Collection path -->
</argument>
</arguments>
</type>
</config>





How should I update my di.xml for displaying second grid in admin using the same custom module?



Any help would be highly appreciated. Thank you.










share|improve this question
















I have displayed my one custom table in a grid format. Now, I want to display one other custom table in a grid format (Under different menu). But I am little bit confused, how to add code in di.xml file



Here is my di.xml which I have created for my first grid :

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="VedMymoduleModelResourceModelNewsCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
<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">VedMymoduleModelResourceModelNews</argument> <!-- Path -->
</arguments>
</virtualType>
<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<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">VedMymoduleModelResourceModelNewsCollection</item> <!-- Collection path -->
</argument>
</arguments>
</type>
</config>





How should I update my di.xml for displaying second grid in admin using the same custom module?



Any help would be highly appreciated. Thank you.







module grid magento2.1.0 di.xml






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 12 '16 at 4:38







vedu

















asked Aug 11 '16 at 10:08









veduvedu

4171 gold badge12 silver badges34 bronze badges




4171 gold badge12 silver badges34 bronze badges












  • did you got any solution?

    – Piyush
    Jun 7 '17 at 13:18











  • No, I did not get. Let me know if you find anything.

    – vedu
    Jun 8 '17 at 5:15

















  • did you got any solution?

    – Piyush
    Jun 7 '17 at 13:18











  • No, I did not get. Let me know if you find anything.

    – vedu
    Jun 8 '17 at 5:15
















did you got any solution?

– Piyush
Jun 7 '17 at 13:18





did you got any solution?

– Piyush
Jun 7 '17 at 13:18













No, I did not get. Let me know if you find anything.

– vedu
Jun 8 '17 at 5:15





No, I did not get. Let me know if you find anything.

– vedu
Jun 8 '17 at 5:15










2 Answers
2






active

oldest

votes


















1














To add second grid in same module you have to add collection data of second grid as second item of CollectionFactory node's collections argument.
So in your case CollectionFactory will look like this -



<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<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">VedMymoduleModelResourceModelNewsCollection</item> <!-- Collection path -->
<item name="mymodule_secondmodel_grid_data_source" xsi:type="string">VedMymoduleModelResourceModelSecondModelCollection</item> <!-- Collection path added for second grid -->
</argument>
</arguments>
</type>


The other nodes in the di.xml can be repeated for the second grid with change in unique_name for nodes (e.g - FilterPool, DataProvider, SerarchResult nodes) ,listing_file_name, Collection and ResourceModel path respectively different for each grid.



Here is the example of my di.xml having two grid -



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">

<!-- This nodes below are for first grid -->
<virtualType name="firstGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here firstGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
<arguments>
<argument name="appliers" xsi:type="array">
<item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
<item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
</argument>
</arguments>
</virtualType>
<virtualType name="FirstGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here FirstGridDataProvider is unique name for Dataprovider node -->
<arguments>
<argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelFirstGridModelCollection</argument>
<argument name="filterPool" xsi:type="object" shared="false">firstGridFilterPool</argument>
</arguments>
</virtualType>
<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="first_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModelGridCollection</item> <!-- Add Collection data for First Grid -->
<item name="second_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModelGridCollection</item> <!-- Add Collection data for Second Grid -->
</argument>
</arguments>
</type>
<virtualType name="NamespaceModulenameModelResourceModelFirstGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">first_grid_tablename</argument>
<argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModel</argument>
</arguments>
</virtualType>

<!-- This nodes below are repeated for Second grid -->
<virtualType name="SecondGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here SecondGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
<arguments>
<argument name="appliers" xsi:type="array">
<item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
<item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
</argument>
</arguments>
</virtualType>
<virtualType name="SecondGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here SecondGridDataProvider is unique name for Dataprovider node -->
<arguments>
<argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelSecondGridModelCollection</argument>
<argument name="filterPool" xsi:type="object" shared="false">SecondGridFilterPool</argument>
</arguments>
</virtualType>

<virtualType name="NamespaceModulenameModelResourceModelSecondGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">second_grid_tablename</argument>
<argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModel</argument>
</arguments>
</virtualType>
</config>


Hope it will help you.






share|improve this answer






























    0















    You can do this by following code




    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
    <arguments>
    <argument name="collections" xsi:type="array">
    <item name="first_data_source" xsi:type="string">VendorModuleModelResourceModelFirstGridCollection</item>
    <item name="second_data_source" xsi:type="string">VendorModuleModelResourceModelSecondGridCollection</item>
    </argument>
    </arguments>
    </type>
    <!-- First -->
    <virtualType name="VendorModuleModelResourceModelFirstGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
    <arguments>
    <argument name="mainTable" xsi:type="string">first_table_name</argument>
    <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelFirst</argument>
    </arguments>
    </virtualType>
    <!-- Second -->
    <virtualType name="VendorModuleModelResourceModelSecondGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
    <arguments>
    <argument name="mainTable" xsi:type="string">second_table_name</argument>
    <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelSecond</argument>
    </arguments>
    </virtualType>
    </config>


    Hope it helps.






    share|improve this answer

























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "479"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f130992%2fmagento-2-display-multiple-grids-in-admin-area%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      To add second grid in same module you have to add collection data of second grid as second item of CollectionFactory node's collections argument.
      So in your case CollectionFactory will look like this -



      <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
      <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">VedMymoduleModelResourceModelNewsCollection</item> <!-- Collection path -->
      <item name="mymodule_secondmodel_grid_data_source" xsi:type="string">VedMymoduleModelResourceModelSecondModelCollection</item> <!-- Collection path added for second grid -->
      </argument>
      </arguments>
      </type>


      The other nodes in the di.xml can be repeated for the second grid with change in unique_name for nodes (e.g - FilterPool, DataProvider, SerarchResult nodes) ,listing_file_name, Collection and ResourceModel path respectively different for each grid.



      Here is the example of my di.xml having two grid -



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">

      <!-- This nodes below are for first grid -->
      <virtualType name="firstGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here firstGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
      <arguments>
      <argument name="appliers" xsi:type="array">
      <item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
      <item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
      </argument>
      </arguments>
      </virtualType>
      <virtualType name="FirstGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here FirstGridDataProvider is unique name for Dataprovider node -->
      <arguments>
      <argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelFirstGridModelCollection</argument>
      <argument name="filterPool" xsi:type="object" shared="false">firstGridFilterPool</argument>
      </arguments>
      </virtualType>
      <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
      <arguments>
      <argument name="collections" xsi:type="array">
      <item name="first_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModelGridCollection</item> <!-- Add Collection data for First Grid -->
      <item name="second_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModelGridCollection</item> <!-- Add Collection data for Second Grid -->
      </argument>
      </arguments>
      </type>
      <virtualType name="NamespaceModulenameModelResourceModelFirstGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
      <arguments>
      <argument name="mainTable" xsi:type="string">first_grid_tablename</argument>
      <argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModel</argument>
      </arguments>
      </virtualType>

      <!-- This nodes below are repeated for Second grid -->
      <virtualType name="SecondGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here SecondGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
      <arguments>
      <argument name="appliers" xsi:type="array">
      <item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
      <item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
      </argument>
      </arguments>
      </virtualType>
      <virtualType name="SecondGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here SecondGridDataProvider is unique name for Dataprovider node -->
      <arguments>
      <argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelSecondGridModelCollection</argument>
      <argument name="filterPool" xsi:type="object" shared="false">SecondGridFilterPool</argument>
      </arguments>
      </virtualType>

      <virtualType name="NamespaceModulenameModelResourceModelSecondGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
      <arguments>
      <argument name="mainTable" xsi:type="string">second_grid_tablename</argument>
      <argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModel</argument>
      </arguments>
      </virtualType>
      </config>


      Hope it will help you.






      share|improve this answer



























        1














        To add second grid in same module you have to add collection data of second grid as second item of CollectionFactory node's collections argument.
        So in your case CollectionFactory will look like this -



        <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
        <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">VedMymoduleModelResourceModelNewsCollection</item> <!-- Collection path -->
        <item name="mymodule_secondmodel_grid_data_source" xsi:type="string">VedMymoduleModelResourceModelSecondModelCollection</item> <!-- Collection path added for second grid -->
        </argument>
        </arguments>
        </type>


        The other nodes in the di.xml can be repeated for the second grid with change in unique_name for nodes (e.g - FilterPool, DataProvider, SerarchResult nodes) ,listing_file_name, Collection and ResourceModel path respectively different for each grid.



        Here is the example of my di.xml having two grid -



        <?xml version="1.0"?>
        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">

        <!-- This nodes below are for first grid -->
        <virtualType name="firstGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here firstGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
        <arguments>
        <argument name="appliers" xsi:type="array">
        <item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
        <item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
        </argument>
        </arguments>
        </virtualType>
        <virtualType name="FirstGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here FirstGridDataProvider is unique name for Dataprovider node -->
        <arguments>
        <argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelFirstGridModelCollection</argument>
        <argument name="filterPool" xsi:type="object" shared="false">firstGridFilterPool</argument>
        </arguments>
        </virtualType>
        <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
        <arguments>
        <argument name="collections" xsi:type="array">
        <item name="first_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModelGridCollection</item> <!-- Add Collection data for First Grid -->
        <item name="second_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModelGridCollection</item> <!-- Add Collection data for Second Grid -->
        </argument>
        </arguments>
        </type>
        <virtualType name="NamespaceModulenameModelResourceModelFirstGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
        <arguments>
        <argument name="mainTable" xsi:type="string">first_grid_tablename</argument>
        <argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModel</argument>
        </arguments>
        </virtualType>

        <!-- This nodes below are repeated for Second grid -->
        <virtualType name="SecondGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here SecondGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
        <arguments>
        <argument name="appliers" xsi:type="array">
        <item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
        <item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
        </argument>
        </arguments>
        </virtualType>
        <virtualType name="SecondGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here SecondGridDataProvider is unique name for Dataprovider node -->
        <arguments>
        <argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelSecondGridModelCollection</argument>
        <argument name="filterPool" xsi:type="object" shared="false">SecondGridFilterPool</argument>
        </arguments>
        </virtualType>

        <virtualType name="NamespaceModulenameModelResourceModelSecondGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
        <arguments>
        <argument name="mainTable" xsi:type="string">second_grid_tablename</argument>
        <argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModel</argument>
        </arguments>
        </virtualType>
        </config>


        Hope it will help you.






        share|improve this answer

























          1












          1








          1







          To add second grid in same module you have to add collection data of second grid as second item of CollectionFactory node's collections argument.
          So in your case CollectionFactory will look like this -



          <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
          <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">VedMymoduleModelResourceModelNewsCollection</item> <!-- Collection path -->
          <item name="mymodule_secondmodel_grid_data_source" xsi:type="string">VedMymoduleModelResourceModelSecondModelCollection</item> <!-- Collection path added for second grid -->
          </argument>
          </arguments>
          </type>


          The other nodes in the di.xml can be repeated for the second grid with change in unique_name for nodes (e.g - FilterPool, DataProvider, SerarchResult nodes) ,listing_file_name, Collection and ResourceModel path respectively different for each grid.



          Here is the example of my di.xml having two grid -



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">

          <!-- This nodes below are for first grid -->
          <virtualType name="firstGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here firstGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
          <arguments>
          <argument name="appliers" xsi:type="array">
          <item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
          <item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
          </argument>
          </arguments>
          </virtualType>
          <virtualType name="FirstGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here FirstGridDataProvider is unique name for Dataprovider node -->
          <arguments>
          <argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelFirstGridModelCollection</argument>
          <argument name="filterPool" xsi:type="object" shared="false">firstGridFilterPool</argument>
          </arguments>
          </virtualType>
          <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
          <arguments>
          <argument name="collections" xsi:type="array">
          <item name="first_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModelGridCollection</item> <!-- Add Collection data for First Grid -->
          <item name="second_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModelGridCollection</item> <!-- Add Collection data for Second Grid -->
          </argument>
          </arguments>
          </type>
          <virtualType name="NamespaceModulenameModelResourceModelFirstGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
          <arguments>
          <argument name="mainTable" xsi:type="string">first_grid_tablename</argument>
          <argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModel</argument>
          </arguments>
          </virtualType>

          <!-- This nodes below are repeated for Second grid -->
          <virtualType name="SecondGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here SecondGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
          <arguments>
          <argument name="appliers" xsi:type="array">
          <item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
          <item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
          </argument>
          </arguments>
          </virtualType>
          <virtualType name="SecondGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here SecondGridDataProvider is unique name for Dataprovider node -->
          <arguments>
          <argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelSecondGridModelCollection</argument>
          <argument name="filterPool" xsi:type="object" shared="false">SecondGridFilterPool</argument>
          </arguments>
          </virtualType>

          <virtualType name="NamespaceModulenameModelResourceModelSecondGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
          <arguments>
          <argument name="mainTable" xsi:type="string">second_grid_tablename</argument>
          <argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModel</argument>
          </arguments>
          </virtualType>
          </config>


          Hope it will help you.






          share|improve this answer













          To add second grid in same module you have to add collection data of second grid as second item of CollectionFactory node's collections argument.
          So in your case CollectionFactory will look like this -



          <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
          <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">VedMymoduleModelResourceModelNewsCollection</item> <!-- Collection path -->
          <item name="mymodule_secondmodel_grid_data_source" xsi:type="string">VedMymoduleModelResourceModelSecondModelCollection</item> <!-- Collection path added for second grid -->
          </argument>
          </arguments>
          </type>


          The other nodes in the di.xml can be repeated for the second grid with change in unique_name for nodes (e.g - FilterPool, DataProvider, SerarchResult nodes) ,listing_file_name, Collection and ResourceModel path respectively different for each grid.



          Here is the example of my di.xml having two grid -



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">

          <!-- This nodes below are for first grid -->
          <virtualType name="firstGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here firstGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
          <arguments>
          <argument name="appliers" xsi:type="array">
          <item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
          <item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
          </argument>
          </arguments>
          </virtualType>
          <virtualType name="FirstGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here FirstGridDataProvider is unique name for Dataprovider node -->
          <arguments>
          <argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelFirstGridModelCollection</argument>
          <argument name="filterPool" xsi:type="object" shared="false">firstGridFilterPool</argument>
          </arguments>
          </virtualType>
          <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
          <arguments>
          <argument name="collections" xsi:type="array">
          <item name="first_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModelGridCollection</item> <!-- Add Collection data for First Grid -->
          <item name="second_grid_data_source" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModelGridCollection</item> <!-- Add Collection data for Second Grid -->
          </argument>
          </arguments>
          </type>
          <virtualType name="NamespaceModulenameModelResourceModelFirstGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
          <arguments>
          <argument name="mainTable" xsi:type="string">first_grid_tablename</argument>
          <argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelFirstGridModel</argument>
          </arguments>
          </virtualType>

          <!-- This nodes below are repeated for Second grid -->
          <virtualType name="SecondGridFilterPool" type="MagentoFrameworkViewElementUiComponentDataProviderFilterPool"> <!-- here SecondGridFilterPool is unique name for filterpool node and it is later user as Dataprovider node's filerPool argument's value -->
          <arguments>
          <argument name="appliers" xsi:type="array">
          <item name="regular" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderRegularFilter</item>
          <item name="fulltext" xsi:type="object">MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter</item>
          </argument>
          </arguments>
          </virtualType>
          <virtualType name="SecondGridDataProvider" type="MagentoFrameworkViewElementUiComponentDataProviderDataProvider"> <!-- here SecondGridDataProvider is unique name for Dataprovider node -->
          <arguments>
          <argument name="collection" xsi:type="object" shared="false">NamespaceModulenameModelResourceModelSecondGridModelCollection</argument>
          <argument name="filterPool" xsi:type="object" shared="false">SecondGridFilterPool</argument>
          </arguments>
          </virtualType>

          <virtualType name="NamespaceModulenameModelResourceModelSecondGridModelGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
          <arguments>
          <argument name="mainTable" xsi:type="string">second_grid_tablename</argument>
          <argument name="resourceModel" xsi:type="string">NamespaceModulenameModelResourceModelSecondGridModel</argument>
          </arguments>
          </virtualType>
          </config>


          Hope it will help you.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 8 '17 at 14:34









          PiyushPiyush

          4,8437 gold badges20 silver badges56 bronze badges




          4,8437 gold badges20 silver badges56 bronze badges























              0















              You can do this by following code




              <?xml version="1.0"?>
              <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
              <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
              <arguments>
              <argument name="collections" xsi:type="array">
              <item name="first_data_source" xsi:type="string">VendorModuleModelResourceModelFirstGridCollection</item>
              <item name="second_data_source" xsi:type="string">VendorModuleModelResourceModelSecondGridCollection</item>
              </argument>
              </arguments>
              </type>
              <!-- First -->
              <virtualType name="VendorModuleModelResourceModelFirstGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
              <arguments>
              <argument name="mainTable" xsi:type="string">first_table_name</argument>
              <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelFirst</argument>
              </arguments>
              </virtualType>
              <!-- Second -->
              <virtualType name="VendorModuleModelResourceModelSecondGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
              <arguments>
              <argument name="mainTable" xsi:type="string">second_table_name</argument>
              <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelSecond</argument>
              </arguments>
              </virtualType>
              </config>


              Hope it helps.






              share|improve this answer



























                0















                You can do this by following code




                <?xml version="1.0"?>
                <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
                <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
                <arguments>
                <argument name="collections" xsi:type="array">
                <item name="first_data_source" xsi:type="string">VendorModuleModelResourceModelFirstGridCollection</item>
                <item name="second_data_source" xsi:type="string">VendorModuleModelResourceModelSecondGridCollection</item>
                </argument>
                </arguments>
                </type>
                <!-- First -->
                <virtualType name="VendorModuleModelResourceModelFirstGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
                <arguments>
                <argument name="mainTable" xsi:type="string">first_table_name</argument>
                <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelFirst</argument>
                </arguments>
                </virtualType>
                <!-- Second -->
                <virtualType name="VendorModuleModelResourceModelSecondGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
                <arguments>
                <argument name="mainTable" xsi:type="string">second_table_name</argument>
                <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelSecond</argument>
                </arguments>
                </virtualType>
                </config>


                Hope it helps.






                share|improve this answer

























                  0












                  0








                  0








                  You can do this by following code




                  <?xml version="1.0"?>
                  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
                  <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
                  <arguments>
                  <argument name="collections" xsi:type="array">
                  <item name="first_data_source" xsi:type="string">VendorModuleModelResourceModelFirstGridCollection</item>
                  <item name="second_data_source" xsi:type="string">VendorModuleModelResourceModelSecondGridCollection</item>
                  </argument>
                  </arguments>
                  </type>
                  <!-- First -->
                  <virtualType name="VendorModuleModelResourceModelFirstGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
                  <arguments>
                  <argument name="mainTable" xsi:type="string">first_table_name</argument>
                  <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelFirst</argument>
                  </arguments>
                  </virtualType>
                  <!-- Second -->
                  <virtualType name="VendorModuleModelResourceModelSecondGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
                  <arguments>
                  <argument name="mainTable" xsi:type="string">second_table_name</argument>
                  <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelSecond</argument>
                  </arguments>
                  </virtualType>
                  </config>


                  Hope it helps.






                  share|improve this answer














                  You can do this by following code




                  <?xml version="1.0"?>
                  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
                  <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
                  <arguments>
                  <argument name="collections" xsi:type="array">
                  <item name="first_data_source" xsi:type="string">VendorModuleModelResourceModelFirstGridCollection</item>
                  <item name="second_data_source" xsi:type="string">VendorModuleModelResourceModelSecondGridCollection</item>
                  </argument>
                  </arguments>
                  </type>
                  <!-- First -->
                  <virtualType name="VendorModuleModelResourceModelFirstGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
                  <arguments>
                  <argument name="mainTable" xsi:type="string">first_table_name</argument>
                  <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelFirst</argument>
                  </arguments>
                  </virtualType>
                  <!-- Second -->
                  <virtualType name="VendorModuleModelResourceModelSecondGridCollection" type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
                  <arguments>
                  <argument name="mainTable" xsi:type="string">second_table_name</argument>
                  <argument name="resourceModel" xsi:type="string">VendorModuleModelResourceModelSecond</argument>
                  </arguments>
                  </virtualType>
                  </config>


                  Hope it helps.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 5 at 4:38









                  Mohit RaneMohit Rane

                  48213 bronze badges




                  48213 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Magento Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f130992%2fmagento-2-display-multiple-grids-in-admin-area%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                      Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                      Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?