Skip to main content

Magenot Magento 2 Custom Report grid is not working

Source Link

Magenot 2 Custom Report grid is not working

Is anyone has created custom Report grid in Magento 2 Admin panel?

We have started to create a report but we are facing an issue with display data and while we click on "Refresh" button entire page is messed up.

<?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">
<update handle="reports_report_grid"/>
<body>
    <referenceBlock name="adminhtml.report.grid">
        <arguments>
            <argument name="id" xsi:type="string">gridMaterialReport</argument>
            <argument name="dataSource" xsi:type="object">Commercepundit\CoreAdminOrder\Model\ResourceModel\Material\Collection\Initial</argument>
        </arguments>
    </referenceBlock>
    <referenceBlock name="adminhtml.report.grid.export">
        <arguments>
            <argument name="exportTypes" xsi:type="array">
                <item name="csv" xsi:type="array">
                    <item name="urlPath" xsi:type="string">*/*/exportOrdersCsv</item>
                </item>
                <item name="excel" xsi:type="array">
                    <item name="urlPath" xsi:type="string">*/*/exportOrdersExcel</item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
    <referenceBlock name="adminhtml.report.grid.columnSet">
        <arguments>
            <argument name="count_totals" xsi:type="string">1</argument>
        </arguments>
        <block class="Magento\Backend\Block\Widget\Grid\Column" name="adminhtml.report.grid.columnSet.order_id" as="order_id">
            <arguments>
                <argument name="header" xsi:type="string" translate="true">Order Id</argument>
                <argument name="sortable" xsi:type="string">0</argument>
                <argument name="type" xsi:type="string">text</argument>
                <argument name="index" xsi:type="string">order_id</argument>
                <argument name="id" xsi:type="string">order_id</argument>
                <argument name="column_css_class" xsi:type="string">col-name</argument>
                <argument name="header_css_class" xsi:type="string">col-name</argument>
            </arguments>
        </block>
        <block class="Magento\Backend\Block\Widget\Grid\Column" name="adminhtml.report.grid.columnSet.sqft" as="sqft">
            <arguments>
                <argument name="header" xsi:type="string" translate="true">Sqft</argument>
                <argument name="sortable" xsi:type="string">0</argument>
                <argument name="type" xsi:type="string">number</argument>
                <argument name="index" xsi:type="string">sqft</argument>
                <argument name="total" xsi:type="string">sum</argument>
                <argument name="id" xsi:type="string">sqft</argument>
                <argument name="column_css_class" xsi:type="string">col-qty</argument>
                <argument name="header_css_class" xsi:type="string">col-qty</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

+++++++++++++++++

enter image description here

While we can click on Refresh entire page is look like below.

enter image description here

Can anyone help me on this??

Thanks,