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 3 hours ago
PathfinderPathfinder
14010
14010
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
47 mins ago
1
then how your layout file called whichgrid2_grid_index.xml
?
– Himanshu
43 mins ago
1
This code is for loading data collection
– Himanshu
41 mins ago
1
i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
– Pathfinder
38 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
36 mins ago
|
show 5 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 1 hour ago
Nauman m. MansuriNauman m. Mansuri
1618
1618
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
47 mins ago
1
then how your layout file called whichgrid2_grid_index.xml
?
– Himanshu
43 mins ago
1
This code is for loading data collection
– Himanshu
41 mins ago
1
i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
– Pathfinder
38 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
36 mins ago
|
show 5 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
47 mins ago
1
then how your layout file called whichgrid2_grid_index.xml
?
– Himanshu
43 mins ago
1
This code is for loading data collection
– Himanshu
41 mins ago
1
i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
– Pathfinder
38 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
36 mins ago
|
show 5 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 34 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
47 mins ago
1
then how your layout file called whichgrid2_grid_index.xml
?
– Himanshu
43 mins ago
1
This code is for loading data collection
– Himanshu
41 mins ago
1
i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
– Pathfinder
38 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
36 mins ago
|
show 5 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
47 mins ago
1
then how your layout file called whichgrid2_grid_index.xml
?
– Himanshu
43 mins ago
1
This code is for loading data collection
– Himanshu
41 mins ago
1
i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
– Pathfinder
38 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
36 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
47 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
47 mins ago
1
1
then how your layout file called which
grid2_grid_index.xml
?– Himanshu
43 mins ago
then how your layout file called which
grid2_grid_index.xml
?– Himanshu
43 mins ago
1
1
This code is for loading data collection
– Himanshu
41 mins ago
This code is for loading data collection
– Himanshu
41 mins ago
1
1
i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
– Pathfinder
38 mins ago
i.imgur.com/N561Pfg.png i.imgur.com/lMMRg41.png
– Pathfinder
38 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
36 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
36 mins ago
|
show 5 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