0

I have created custom grids in Admin and given store switcher by XML file as below.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <title>Products</title>
</head>
<update handle="styles"/>
<body>
    <referenceContainer name="page.main.actions">
        <block class="Magento\Backend\Block\Store\Switcher" name="products.store.switcher" template="Magento_Backend::store/switcher.phtml"/>
    </referenceContainer>       
    <referenceContainer name="content">
        <uiComponent name="products_listing"/>
    </referenceContainer>
</body>

How can I keep my default store as selected on the page load?

Also I have 4 websites and each have 1 store. on the grid listing page default store view should be selected and display for example US.

When i go record edit I have to display store switcher there to. And in this store switcher only display website and store which belongs to that product. Currently from list page I select the store and go to any product of that store then it's displaying selected store but in dropdown displaying all the websites and stores even product is only for 2 stores.

1 Answer 1

1

Try This :-

<referenceContainer name="page.main.actions">
        <block class="Magento\Backend\Block\Store\Switcher" name="adminhtml.report.shopcart.abandoned.store_switcher">
            <arguments>
                <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="use_confirm" xsi:type="string">0</argument>
                <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument>
            </arguments>
        </block>
    </referenceContainer>
5
  • Tried this but Not working
    – m2dev
    Dec 20, 2019 at 12:05
  • change param value 1 to 0 and check Dec 20, 2019 at 12:16
  • It's also not working
    – m2dev
    Dec 20, 2019 at 12:25
  • check updated answer Dec 20, 2019 at 12:29
  • By that code nothing is displaying. I have 4 websites and each have 1 store. on the grid listing page default store view should be selected and display for example US. When i go record edit I have to display store switcher there to. And in this strore switcher only display website and store which belongs to that product. Currently from list page I select the store that go to any product of that store it's displaying selected store but in dropdown displaying all the websites and stores even product is only for 2 stores.
    – m2dev
    Dec 20, 2019 at 12:54

Your Answer

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

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