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;
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
add a comment |
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
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
add a comment |
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
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
module grid magento2.1.0 di.xml
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Jun 8 '17 at 14:34
PiyushPiyush
4,8437 gold badges20 silver badges56 bronze badges
4,8437 gold badges20 silver badges56 bronze badges
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Jul 5 at 4:38
Mohit RaneMohit Rane
48213 bronze badges
48213 bronze badges
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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