1

I have create an admin grid in M2, Below is grid ui_component xml file. When I hit the admin url it shows blank page, page source is below as well.

Grid ui_component xml

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">mastering_items_grid.mastering_items_grid_data_source</item>
            <item name="deps" xsi:type="string">mastering_items_grid.mastering_items_grid_data_source</item>
        </item>
        <item name="spinner" xsi:type="string">mastering_items_columns</item>
    </argument>
    <dataSource name="mastering_items_grid_data_source">
        <argument name="dataProvider" xsi:type="configurableObject">
            <argument name="class" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider</argument>
            <argument name="name" xsi:type="string">mastering_items_grid_data_source</argument>
            <argument name="primaryFieldName" xsi:type="string">id</argument>
            <argument name="requestFieldName" xsi:type="string">id</argument>
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="update_url" xsi:type="url" path="mui/index/render"/>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
                </item>
            </argument>
        </argument>
    </dataSource>
    <listingToolbar name="listing_top">
        <bookmark name="bookmarks" />
        <columnsControls name="columns_controls" />
        <exportButton name="export_button" />
        <filterSearch name="fulltext" />
        <filters name="listing_filters" />
        <paging name="listing_paging" />
    </listingToolbar>
    <columns name="mastering_items_columns">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="childDefaults" xsi:type="array">
                    <item name="fieldAction" xsi:type="array">
                        <item name="provider" xsi:type="string">mastering_items_grid.mastering_items_grid.mastering_items_columns</item>
                        <item name="target" xsi:type="string">applyAction</item>
                        <item name="params" xsi:type="array">
                            <item name="0" xsi:type="string">view</item>
                            <item name="1" xsi:type="string">${ $.$data.rowIndex }</item>
                        </item>
                    </item>
                </item>
            </item>
        </argument>
        <selectionsColumn name="ids">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="indexField" xsi:type="string">id</item>
                </item>
            </argument>
        </selectionsColumn>
        <column name="name">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="label" xsi:type="string" translate="true">Name</item>
                </item>
            </argument>
        </column>
        <column name="description">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="label" xsi:type="string" translate="true">Description</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>

Admin page view source ( Blank page )

<!doctype html>
<html lang="en-US">
    <head >
        <script>
    var BASE_URL = 'http://www.magentolocal.com/admin_x1t6kg/mastering/';
    var FORM_KEY = 'tLKrqiMSTIyM2zJl';
    var require = {
        "baseUrl": "http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US"
    };
</script>
        <meta charset="utf-8"/>
<meta name="robots" content="NOINDEX,NOFOLLOW"/>
<meta name="viewport" content="width=1024"/>
<meta name="format-detection" content="telephone=no"/>
<title>Magento Admin</title>
<link  rel="stylesheet" type="text/css"  media="all" href="http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US/extjs/resources/css/ext-all.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US/extjs/resources/css/ytheme-magento.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US/jquery/jstree/themes/default/style.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US/css/styles-old.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US/css/styles.css" />
<link  rel="icon" type="image/x-icon" href="http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US/Magento_Theme/favicon.ico" />
<link  rel="shortcut icon" type="image/x-icon" href="http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US/Magento_Theme/favicon.ico" />
<script  type="text/javascript"  src="http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US/requirejs/require.js"></script>
            </head>
    <body data-container="body" data-mage-init='{"loaderAjax": {}, "loader": { "icon": "http://www.magentolocal.com/pub/static/version1514629578/adminhtml/Magento/backend/en_US/images/loader-2.gif"}}' id="html-body" class="mastering-index-index page-layout-1column">
            </body>
</html>

Admin grid layout xml

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <uiComponent name="mastering_items_grid"/>
        </referenceContainer>
    </body>
</page>

Any Help is much appreciated!

2
  • 1
    Have you linked this in layout xml, please paste your layout xml Dec 30, 2017 at 12:25
  • Yes Neo, Updated question with admin layout xml code. Dec 31, 2017 at 12:14

1 Answer 1

6

Found the issue, it's actually layout defined in admin layout xml file, need to remove that and it works!

Updated admin grid layout xml ( Removed layout="1column" )

<?xml version="1.0"?>
<page  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <uiComponent name="mastering_items_grid"/>
        </referenceContainer>
    </body>
</page>

Thanks

2
  • 1
    3 hours spent on this, found the solution here. TYVM! Note: This is why is a VERY BAD IDEA to just copy/paste code from another place u.u Jul 29, 2020 at 12:12
  • :D lol, I hope it helped, I spent more then 3 hours when i got same issue. Jul 29, 2020 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.