Grid with multiple Resource Models
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/
However when i create a new route to load the same controller:
http:{}/admin/grid2/grid/ . I get no main block content
Here's my component UI based grid setup: Works fine for route /admin/grid/grid.
Does anyone know if i need to duplicate some files/directories to get grid2 to show?
magento2 adminhtml grid admin-controller router
add a comment |
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/
However when i create a new route to load the same controller:
http:{}/admin/grid2/grid/ . I get no main block content
Here's my component UI based grid setup: Works fine for route /admin/grid/grid.
Does anyone know if i need to duplicate some files/directories to get grid2 to show?
magento2 adminhtml grid admin-controller router
add a comment |
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/
However when i create a new route to load the same controller:
http:{}/admin/grid2/grid/ . I get no main block content
Here's my component UI based grid setup: Works fine for route /admin/grid/grid.
Does anyone know if i need to duplicate some files/directories to get grid2 to show?
magento2 adminhtml grid admin-controller router
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/
However when i create a new route to load the same controller:
http:{}/admin/grid2/grid/ . I get no main block content
Here's my component UI based grid setup: Works fine for route /admin/grid/grid.
Does anyone know if i need to duplicate some files/directories to get grid2 to show?
magento2 adminhtml grid admin-controller router
magento2 adminhtml grid admin-controller router
asked Jan 11 at 2:46
PathfinderPathfinder
13611
13611
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml
add a comment |
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.
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 whichgrid2_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
|
show 3 more comments
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%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
You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml
add a comment |
You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml
add a comment |
You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml
You need to create grid2_grid_index.xml file under layout same as grid_grid_index.xml
answered Jan 11 at 5:33
Nauman m. MansuriNauman m. Mansuri
19618
19618
add a comment |
add a comment |
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.
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 whichgrid2_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
|
show 3 more comments
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.
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 whichgrid2_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
|
show 3 more comments
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.
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.
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 whichgrid2_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
|
show 3 more comments
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 whichgrid2_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
|
show 3 more comments
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%2f257463%2fgrid-with-multiple-resource-models%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