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 3 hours ago









      PathfinderPathfinder

      14010




      14010






















          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
              45 mins ago








            • 1




              then how your layout file called which grid2_grid_index.xml ?
              – Himanshu
              41 mins ago








            • 1




              This code is for loading data collection
              – Himanshu
              39 mins ago






            • 1




              i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
              – Pathfinder
              36 mins ago






            • 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
              34 mins ago













            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 1 hour ago









                Nauman m. MansuriNauman m. Mansuri

                1618




                1618

























                    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
                      45 mins ago








                    • 1




                      then how your layout file called which grid2_grid_index.xml ?
                      – Himanshu
                      41 mins ago








                    • 1




                      This code is for loading data collection
                      – Himanshu
                      39 mins ago






                    • 1




                      i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
                      – Pathfinder
                      36 mins ago






                    • 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
                      34 mins ago


















                    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
                      45 mins ago








                    • 1




                      then how your layout file called which grid2_grid_index.xml ?
                      – Himanshu
                      41 mins ago








                    • 1




                      This code is for loading data collection
                      – Himanshu
                      39 mins ago






                    • 1




                      i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
                      – Pathfinder
                      36 mins ago






                    • 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
                      34 mins ago
















                    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 32 mins ago

























                    answered 1 hour ago









                    HimanshuHimanshu

                    728519




                    728519








                    • 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
                      45 mins ago








                    • 1




                      then how your layout file called which grid2_grid_index.xml ?
                      – Himanshu
                      41 mins ago








                    • 1




                      This code is for loading data collection
                      – Himanshu
                      39 mins ago






                    • 1




                      i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
                      – Pathfinder
                      36 mins ago






                    • 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
                      34 mins ago
















                    • 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
                      45 mins ago








                    • 1




                      then how your layout file called which grid2_grid_index.xml ?
                      – Himanshu
                      41 mins ago








                    • 1




                      This code is for loading data collection
                      – Himanshu
                      39 mins ago






                    • 1




                      i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
                      – Pathfinder
                      36 mins ago






                    • 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
                      34 mins ago










                    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
                    45 mins ago






                    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
                    45 mins ago






                    1




                    1




                    then how your layout file called which grid2_grid_index.xml ?
                    – Himanshu
                    41 mins ago






                    then how your layout file called which grid2_grid_index.xml ?
                    – Himanshu
                    41 mins ago






                    1




                    1




                    This code is for loading data collection
                    – Himanshu
                    39 mins ago




                    This code is for loading data collection
                    – Himanshu
                    39 mins ago




                    1




                    1




                    i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
                    – Pathfinder
                    36 mins ago




                    i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
                    – Pathfinder
                    36 mins ago




                    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
                    34 mins ago






                    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
                    34 mins ago




















                    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

                    Accessing regular linux commands in Huawei's Dopra Linux

                    Can't connect RFCOMM socket: Host is down

                    Kernel panic - not syncing: Fatal Exception in Interrupt