I need to make new admin page with a grid, in M2, and along with it, a menu link that will link to it. I have made a menu item successfully, and it looks like it is linked to correct URL, but when I click on it, I am just redirected to admin index page. What am I missing here?
My Namespace/Modulename/etc/acl.xml
is:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Namespace_Modulename::griglia" title="Modulename Griglia" sortOrder="51">
<resource id="Namespace_Modulename::griglia_child_resource" title="Grigla Child Resource" sortOrder="10"/>
</resource>
</resource>
</resources>
</acl>
</config>
My etc/adminhtml/menu.xml
is:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Namespace_Modulename::index" title="Modulename" module="Namespace_Modulename" sortOrder="51" resource="Namespace_Modulename::index"/>
<add id="Namespace_Modulename::griglia" title="Griglia" module="Namespace_Modulename" sortOrder="10" action="modulename/griglia" resource="Namespace_Modulename::griglia" parent="Namespace_Modulename::index"/>
</menu>
</config>
My etc/adminhtml/routes.xml
is:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="admin"> <!-- This part is different from frontend -->
<route id="modulename" frontName="modulename">
<module name="Namespace_Modulename" />
</route>
</router>
</config>
routes.xml
?