0

Is it possible to add simple store switcher for magento2 UI grid like in magento1: enter image description here

(Store switcher must be located not in "Filters" tab)

1 Answer 1

1

You can simply add the switcher block to the top of the listing in layout (same as reports grid do):

<?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="styles"/>
    <body>
        <referenceContainer name="page.main.actions">            
            <block class="Magento\Backend\Block\Store\Switcher" name="adminhtml.report.grid.store_switcher" as="store_switcher">
                <arguments>
                    <argument name="use_confirm" xsi:type="string">0</argument>
                    <argument name="switch_websites" xsi:type="string">1</argument>
                    <argument name="switch_store_groups" xsi:type="string">1</argument>
                    <argument name="switch_store_views" xsi:type="string">1</argument>
                    <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument>
                </arguments>
            </block>
        </referenceContainer>
        <referenceContainer name="content">
            <uiComponent name="your_grid_listing_component"/>
        </referenceContainer>
    </body>
</page>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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