Magento 2 – Copy Sales Order Grid to Custom Module

backendmagento2moduleorder-grid

I want to make a copy of the default Sales Order grid in Magento 2 to my own module. In Magento 1 I have build a custom module to show all backorders. See below:

enter image description here

Now I want to create this module in Magento 2 too but I can't find how to make a copy of the default Sales Order Grid. For Magento 1 I used this tutorial: http://inchoo.net/magento/how-to-create-a-custom-grid-from-scratch/

I have already found a lot of tutorials for Magento 2 about creating custom backend modules but none of them describe how te re-use the code for the current/default sales order grid.

Can you simply make a copy of the di.xml to load all the data?

Thanks in advance

Michel

Best Answer

Just Create admin layout file and add this code. This will load complete sales order grid. Magento 2 is using ui component just adding the name of component will load the order grid sales_order_grid.

<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="sales_order_grid"/>
        </referenceContainer>

    </body>
</page>
Related Topic