Grid with multiple Resource Models












1















I'm trying to use one grid for multiple ResourceModels, so far I've got one grid working fine.



I can load the grid up fine using http:{}/admin/grid/grid/
enter image description here



However when i create a new route to load the same controller:
http:{}/admin/grid2/grid/ . I get no main block content
enter image description here



enter image description here



Here's my component UI based grid setup: Works fine for route /admin/grid/grid.



enter image description here



Does anyone know if i need to duplicate some files/directories to get grid2 to show?










share|improve this question



























    1















    I'm trying to use one grid for multiple ResourceModels, so far I've got one grid working fine.



    I can load the grid up fine using http:{}/admin/grid/grid/
    enter image description here



    However when i create a new route to load the same controller:
    http:{}/admin/grid2/grid/ . I get no main block content
    enter image description here



    enter image description here



    Here's my component UI based grid setup: Works fine for route /admin/grid/grid.



    enter image description here



    Does anyone know if i need to duplicate some files/directories to get grid2 to show?










    share|improve this question

























      1












      1








      1








      I'm trying to use one grid for multiple ResourceModels, so far I've got one grid working fine.



      I can load the grid up fine using http:{}/admin/grid/grid/
      enter image description here



      However when i create a new route to load the same controller:
      http:{}/admin/grid2/grid/ . I get no main block content
      enter image description here



      enter image description here



      Here's my component UI based grid setup: Works fine for route /admin/grid/grid.



      enter image description here



      Does anyone know if i need to duplicate some files/directories to get grid2 to show?










      share|improve this question














      I'm trying to use one grid for multiple ResourceModels, so far I've got one grid working fine.



      I can load the grid up fine using http:{}/admin/grid/grid/
      enter image description here



      However when i create a new route to load the same controller:
      http:{}/admin/grid2/grid/ . I get no main block content
      enter image description here



      enter image description here



      Here's my component UI based grid setup: Works fine for route /admin/grid/grid.



      enter image description here



      Does anyone know if i need to duplicate some files/directories to get grid2 to show?







      magento2 adminhtml grid admin-controller router






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 11 at 2:46









      PathfinderPathfinder

      13611




      13611






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml






          share|improve this answer































            2














            You have to copy only layout file, due to 'grid2' route already mentioned in routes.xml.



            You need to create only grid2_grid_index.xml.

            copy grid_grid_index.xml to grid2_grid_index.xml you can call same ui_component file in that layout.xml file.






            share|improve this answer





















            • 1





              Thank you for the answer! I didn't need to copy the controller to make the grid show, is there some other functionality that needs a copied controller file? Controller/Adminhtml/Grid/Index.php sets the title via resultFactoy->getConfig()->getTitle()->prepend('Grid List'), Http://{}/admin/grid2/grid has "Grid List" Title

              – Pathfinder
              Jan 11 at 5:57








            • 1





              then how your layout file called which grid2_grid_index.xml ?

              – Himanshu
              Jan 11 at 6:01








            • 1





              This code is for loading data collection

              – Himanshu
              Jan 11 at 6:04






            • 1





              i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png

              – Pathfinder
              Jan 11 at 6:07






            • 1





              Oh I got it you have created two routes . so you don't need to create controller file !! yes it will be worked cheers +1

              – Himanshu
              Jan 11 at 6:08













            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%2f257463%2fgrid-with-multiple-resource-models%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














            You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml






            share|improve this answer




























              1














              You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml






              share|improve this answer


























                1












                1








                1







                You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml






                share|improve this answer













                You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 11 at 5:33









                Nauman m. MansuriNauman m. Mansuri

                19618




                19618

























                    2














                    You have to copy only layout file, due to 'grid2' route already mentioned in routes.xml.



                    You need to create only grid2_grid_index.xml.

                    copy grid_grid_index.xml to grid2_grid_index.xml you can call same ui_component file in that layout.xml file.






                    share|improve this answer





















                    • 1





                      Thank you for the answer! I didn't need to copy the controller to make the grid show, is there some other functionality that needs a copied controller file? Controller/Adminhtml/Grid/Index.php sets the title via resultFactoy->getConfig()->getTitle()->prepend('Grid List'), Http://{}/admin/grid2/grid has "Grid List" Title

                      – Pathfinder
                      Jan 11 at 5:57








                    • 1





                      then how your layout file called which grid2_grid_index.xml ?

                      – Himanshu
                      Jan 11 at 6:01








                    • 1





                      This code is for loading data collection

                      – Himanshu
                      Jan 11 at 6:04






                    • 1





                      i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png

                      – Pathfinder
                      Jan 11 at 6:07






                    • 1





                      Oh I got it you have created two routes . so you don't need to create controller file !! yes it will be worked cheers +1

                      – Himanshu
                      Jan 11 at 6:08


















                    2














                    You have to copy only layout file, due to 'grid2' route already mentioned in routes.xml.



                    You need to create only grid2_grid_index.xml.

                    copy grid_grid_index.xml to grid2_grid_index.xml you can call same ui_component file in that layout.xml file.






                    share|improve this answer





















                    • 1





                      Thank you for the answer! I didn't need to copy the controller to make the grid show, is there some other functionality that needs a copied controller file? Controller/Adminhtml/Grid/Index.php sets the title via resultFactoy->getConfig()->getTitle()->prepend('Grid List'), Http://{}/admin/grid2/grid has "Grid List" Title

                      – Pathfinder
                      Jan 11 at 5:57








                    • 1





                      then how your layout file called which grid2_grid_index.xml ?

                      – Himanshu
                      Jan 11 at 6:01








                    • 1





                      This code is for loading data collection

                      – Himanshu
                      Jan 11 at 6:04






                    • 1





                      i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png

                      – Pathfinder
                      Jan 11 at 6:07






                    • 1





                      Oh I got it you have created two routes . so you don't need to create controller file !! yes it will be worked cheers +1

                      – Himanshu
                      Jan 11 at 6:08
















                    2












                    2








                    2







                    You have to copy only layout file, due to 'grid2' route already mentioned in routes.xml.



                    You need to create only grid2_grid_index.xml.

                    copy grid_grid_index.xml to grid2_grid_index.xml you can call same ui_component file in that layout.xml file.






                    share|improve this answer















                    You have to copy only layout file, due to 'grid2' route already mentioned in routes.xml.



                    You need to create only grid2_grid_index.xml.

                    copy grid_grid_index.xml to grid2_grid_index.xml you can call same ui_component file in that layout.xml file.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jan 11 at 6:11

























                    answered Jan 11 at 5:30









                    HimanshuHimanshu

                    829521




                    829521








                    • 1





                      Thank you for the answer! I didn't need to copy the controller to make the grid show, is there some other functionality that needs a copied controller file? Controller/Adminhtml/Grid/Index.php sets the title via resultFactoy->getConfig()->getTitle()->prepend('Grid List'), Http://{}/admin/grid2/grid has "Grid List" Title

                      – Pathfinder
                      Jan 11 at 5:57








                    • 1





                      then how your layout file called which grid2_grid_index.xml ?

                      – Himanshu
                      Jan 11 at 6:01








                    • 1





                      This code is for loading data collection

                      – Himanshu
                      Jan 11 at 6:04






                    • 1





                      i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png

                      – Pathfinder
                      Jan 11 at 6:07






                    • 1





                      Oh I got it you have created two routes . so you don't need to create controller file !! yes it will be worked cheers +1

                      – Himanshu
                      Jan 11 at 6:08
















                    • 1





                      Thank you for the answer! I didn't need to copy the controller to make the grid show, is there some other functionality that needs a copied controller file? Controller/Adminhtml/Grid/Index.php sets the title via resultFactoy->getConfig()->getTitle()->prepend('Grid List'), Http://{}/admin/grid2/grid has "Grid List" Title

                      – Pathfinder
                      Jan 11 at 5:57








                    • 1





                      then how your layout file called which grid2_grid_index.xml ?

                      – Himanshu
                      Jan 11 at 6:01








                    • 1





                      This code is for loading data collection

                      – Himanshu
                      Jan 11 at 6:04






                    • 1





                      i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png

                      – Pathfinder
                      Jan 11 at 6:07






                    • 1





                      Oh I got it you have created two routes . so you don't need to create controller file !! yes it will be worked cheers +1

                      – Himanshu
                      Jan 11 at 6:08










                    1




                    1





                    Thank you for the answer! I didn't need to copy the controller to make the grid show, is there some other functionality that needs a copied controller file? Controller/Adminhtml/Grid/Index.php sets the title via resultFactoy->getConfig()->getTitle()->prepend('Grid List'), Http://{}/admin/grid2/grid has "Grid List" Title

                    – Pathfinder
                    Jan 11 at 5:57







                    Thank you for the answer! I didn't need to copy the controller to make the grid show, is there some other functionality that needs a copied controller file? Controller/Adminhtml/Grid/Index.php sets the title via resultFactoy->getConfig()->getTitle()->prepend('Grid List'), Http://{}/admin/grid2/grid has "Grid List" Title

                    – Pathfinder
                    Jan 11 at 5:57






                    1




                    1





                    then how your layout file called which grid2_grid_index.xml ?

                    – Himanshu
                    Jan 11 at 6:01







                    then how your layout file called which grid2_grid_index.xml ?

                    – Himanshu
                    Jan 11 at 6:01






                    1




                    1





                    This code is for loading data collection

                    – Himanshu
                    Jan 11 at 6:04





                    This code is for loading data collection

                    – Himanshu
                    Jan 11 at 6:04




                    1




                    1





                    i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png

                    – Pathfinder
                    Jan 11 at 6:07





                    i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png

                    – Pathfinder
                    Jan 11 at 6:07




                    1




                    1





                    Oh I got it you have created two routes . so you don't need to create controller file !! yes it will be worked cheers +1

                    – Himanshu
                    Jan 11 at 6:08







                    Oh I got it you have created two routes . so you don't need to create controller file !! yes it will be worked cheers +1

                    – Himanshu
                    Jan 11 at 6:08




















                    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%2f257463%2fgrid-with-multiple-resource-models%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

                    Mario Kart Wii

                    The Binding of Isaac: Rebirth/Afterbirth

                    What does “Dominus providebit” mean?