How to add storeview switcher in custom admin grid which created using ui component in magento2.2.5?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}






up vote
2
down vote

favorite












How to add storeview code in admin grid which created using ui component.



enter image description here










share|improve this question




























    up vote
    2
    down vote

    favorite












    How to add storeview code in admin grid which created using ui component.



    enter image description here










    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      How to add storeview code in admin grid which created using ui component.



      enter image description here










      share|improve this question













      How to add storeview code in admin grid which created using ui component.



      enter image description here







      magento2 multistore uicomponent






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      Rutvee Sojitra

      1,2841121




      1,2841121






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          Update your layout as below.



          <?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="MagentoBackendBlockStoreSwitcher" 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">0</argument>
          <argument name="switch_store_groups" xsi:type="string">0</argument>
          <argument name="switch_store_views" xsi:type="string">1</argument>
          </arguments>
          </block>
          </referenceContainer>
          <referenceContainer name="content">
          <uiComponent name="my_product_listing"/>
          </referenceContainer>
          </body>
          </page>


          To filter products you need to change the UI component for the Bookmark.



          Create a UI component class as :



          namespace MyVendorMyModuleComponent;

          use MagentoFrameworkViewElementUiComponentContextInterface;
          use MagentoUiApiBookmarkManagementInterface;
          use MagentoUiApiBookmarkRepositoryInterface;

          class Bookmark extends MagentoUiComponentBookmark
          {
          public function __construct(
          ContextInterface $context,
          CedAmazonApiProfileRepositoryInterface $profile,
          BookmarkRepositoryInterface $bookmarkRepository,
          BookmarkManagementInterface $bookmarkManagement,
          array $components = ,
          array $data =
          ) {
          parent::__construct($context, $bookmarkRepository, $bookmarkManagement, $components, $data);
          $this->profile = $profile;
          }

          /**
          * Register component
          *
          * @return void
          */
          public function prepare()
          {
          $namespace = $this->getContext()->getRequestParam('namespace', $this->getContext()->getNamespace());
          $config = ;
          if (!empty($namespace)) {
          $storeId = $this->getContext()->getRequestParam('store');

          if (empty($storeId)) {
          $storeId = $this->getContext()->getFilterParam('store_id');
          }

          $bookmarks = $this->bookmarkManagement->loadByNamespace($namespace);
          /** @var MagentoUiApiDataBookmarkInterface $bookmark */
          foreach ($bookmarks->getItems() as $bookmark) {
          if ($bookmark->isCurrent()) {
          $config['activeIndex'] = $bookmark->getIdentifier();
          }

          $config = array_merge_recursive($config, $bookmark->getConfig());

          if (!empty($storeId)) {
          $config['current']['filters']['applied']['store_id'] = $storeId;
          }
          }
          }

          $this->setData('config', array_replace_recursive($config, $this->getConfiguration($this)));

          parent::prepare();

          $jsConfig = $this->getConfiguration($this);
          $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
          }
          }


          Add the Bookmark UI component in your UI grid 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">
          <listingToolbar name="listing_top">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="sticky" xsi:type="boolean">true</item>
          <item name="template" xsi:type="string">ui/grid/toolbar</item>
          </item>
          </argument>
          <bookmark name="bookmarks" class="MyVendorMyModuleComponentBookmark">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/bookmarks/bookmarks</item>
          <item name="storageConfig" xsi:type="array">
          <item name="saveUrl" xsi:type="url" path="mui/bookmark/save"/>
          <item name="deleteUrl" xsi:type="url" path="mui/bookmark/delete"/>
          <item name="namespace" xsi:type="string">my_product_listing</item>
          </item>
          </item>
          </argument>
          </bookmark>
          <columnsControls name="columns_controls"/>
          <filters name="listing_filters" />
          <paging name="listing_paging"/>
          </listingToolbar>
          </listing>


          Replace: MyVendorMyModule and my_product_listing with your namespace.



          Also there is another way of add the store selector in the grid i.e via filters same as catalog product grid.






          share|improve this answer



















          • 1




            Thanks a lot it's working!!
            – Rutvee Sojitra
            1 hour ago










          • Also, Do you want to filter products on the basis of the selected store? Because that's another thing to be done.
            – Milind Singh
            1 hour ago










          • yes i want to do
            – Rutvee Sojitra
            1 hour ago










          • @RutveeSojitra I have updated the code. hope it helps
            – Milind Singh
            59 mins ago













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f252738%2fhow-to-add-storeview-switcher-in-custom-admin-grid-which-created-using-ui-compon%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          4
          down vote



          accepted










          Update your layout as below.



          <?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="MagentoBackendBlockStoreSwitcher" 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">0</argument>
          <argument name="switch_store_groups" xsi:type="string">0</argument>
          <argument name="switch_store_views" xsi:type="string">1</argument>
          </arguments>
          </block>
          </referenceContainer>
          <referenceContainer name="content">
          <uiComponent name="my_product_listing"/>
          </referenceContainer>
          </body>
          </page>


          To filter products you need to change the UI component for the Bookmark.



          Create a UI component class as :



          namespace MyVendorMyModuleComponent;

          use MagentoFrameworkViewElementUiComponentContextInterface;
          use MagentoUiApiBookmarkManagementInterface;
          use MagentoUiApiBookmarkRepositoryInterface;

          class Bookmark extends MagentoUiComponentBookmark
          {
          public function __construct(
          ContextInterface $context,
          CedAmazonApiProfileRepositoryInterface $profile,
          BookmarkRepositoryInterface $bookmarkRepository,
          BookmarkManagementInterface $bookmarkManagement,
          array $components = ,
          array $data =
          ) {
          parent::__construct($context, $bookmarkRepository, $bookmarkManagement, $components, $data);
          $this->profile = $profile;
          }

          /**
          * Register component
          *
          * @return void
          */
          public function prepare()
          {
          $namespace = $this->getContext()->getRequestParam('namespace', $this->getContext()->getNamespace());
          $config = ;
          if (!empty($namespace)) {
          $storeId = $this->getContext()->getRequestParam('store');

          if (empty($storeId)) {
          $storeId = $this->getContext()->getFilterParam('store_id');
          }

          $bookmarks = $this->bookmarkManagement->loadByNamespace($namespace);
          /** @var MagentoUiApiDataBookmarkInterface $bookmark */
          foreach ($bookmarks->getItems() as $bookmark) {
          if ($bookmark->isCurrent()) {
          $config['activeIndex'] = $bookmark->getIdentifier();
          }

          $config = array_merge_recursive($config, $bookmark->getConfig());

          if (!empty($storeId)) {
          $config['current']['filters']['applied']['store_id'] = $storeId;
          }
          }
          }

          $this->setData('config', array_replace_recursive($config, $this->getConfiguration($this)));

          parent::prepare();

          $jsConfig = $this->getConfiguration($this);
          $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
          }
          }


          Add the Bookmark UI component in your UI grid 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">
          <listingToolbar name="listing_top">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="sticky" xsi:type="boolean">true</item>
          <item name="template" xsi:type="string">ui/grid/toolbar</item>
          </item>
          </argument>
          <bookmark name="bookmarks" class="MyVendorMyModuleComponentBookmark">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/bookmarks/bookmarks</item>
          <item name="storageConfig" xsi:type="array">
          <item name="saveUrl" xsi:type="url" path="mui/bookmark/save"/>
          <item name="deleteUrl" xsi:type="url" path="mui/bookmark/delete"/>
          <item name="namespace" xsi:type="string">my_product_listing</item>
          </item>
          </item>
          </argument>
          </bookmark>
          <columnsControls name="columns_controls"/>
          <filters name="listing_filters" />
          <paging name="listing_paging"/>
          </listingToolbar>
          </listing>


          Replace: MyVendorMyModule and my_product_listing with your namespace.



          Also there is another way of add the store selector in the grid i.e via filters same as catalog product grid.






          share|improve this answer



















          • 1




            Thanks a lot it's working!!
            – Rutvee Sojitra
            1 hour ago










          • Also, Do you want to filter products on the basis of the selected store? Because that's another thing to be done.
            – Milind Singh
            1 hour ago










          • yes i want to do
            – Rutvee Sojitra
            1 hour ago










          • @RutveeSojitra I have updated the code. hope it helps
            – Milind Singh
            59 mins ago

















          up vote
          4
          down vote



          accepted










          Update your layout as below.



          <?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="MagentoBackendBlockStoreSwitcher" 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">0</argument>
          <argument name="switch_store_groups" xsi:type="string">0</argument>
          <argument name="switch_store_views" xsi:type="string">1</argument>
          </arguments>
          </block>
          </referenceContainer>
          <referenceContainer name="content">
          <uiComponent name="my_product_listing"/>
          </referenceContainer>
          </body>
          </page>


          To filter products you need to change the UI component for the Bookmark.



          Create a UI component class as :



          namespace MyVendorMyModuleComponent;

          use MagentoFrameworkViewElementUiComponentContextInterface;
          use MagentoUiApiBookmarkManagementInterface;
          use MagentoUiApiBookmarkRepositoryInterface;

          class Bookmark extends MagentoUiComponentBookmark
          {
          public function __construct(
          ContextInterface $context,
          CedAmazonApiProfileRepositoryInterface $profile,
          BookmarkRepositoryInterface $bookmarkRepository,
          BookmarkManagementInterface $bookmarkManagement,
          array $components = ,
          array $data =
          ) {
          parent::__construct($context, $bookmarkRepository, $bookmarkManagement, $components, $data);
          $this->profile = $profile;
          }

          /**
          * Register component
          *
          * @return void
          */
          public function prepare()
          {
          $namespace = $this->getContext()->getRequestParam('namespace', $this->getContext()->getNamespace());
          $config = ;
          if (!empty($namespace)) {
          $storeId = $this->getContext()->getRequestParam('store');

          if (empty($storeId)) {
          $storeId = $this->getContext()->getFilterParam('store_id');
          }

          $bookmarks = $this->bookmarkManagement->loadByNamespace($namespace);
          /** @var MagentoUiApiDataBookmarkInterface $bookmark */
          foreach ($bookmarks->getItems() as $bookmark) {
          if ($bookmark->isCurrent()) {
          $config['activeIndex'] = $bookmark->getIdentifier();
          }

          $config = array_merge_recursive($config, $bookmark->getConfig());

          if (!empty($storeId)) {
          $config['current']['filters']['applied']['store_id'] = $storeId;
          }
          }
          }

          $this->setData('config', array_replace_recursive($config, $this->getConfiguration($this)));

          parent::prepare();

          $jsConfig = $this->getConfiguration($this);
          $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
          }
          }


          Add the Bookmark UI component in your UI grid 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">
          <listingToolbar name="listing_top">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="sticky" xsi:type="boolean">true</item>
          <item name="template" xsi:type="string">ui/grid/toolbar</item>
          </item>
          </argument>
          <bookmark name="bookmarks" class="MyVendorMyModuleComponentBookmark">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/bookmarks/bookmarks</item>
          <item name="storageConfig" xsi:type="array">
          <item name="saveUrl" xsi:type="url" path="mui/bookmark/save"/>
          <item name="deleteUrl" xsi:type="url" path="mui/bookmark/delete"/>
          <item name="namespace" xsi:type="string">my_product_listing</item>
          </item>
          </item>
          </argument>
          </bookmark>
          <columnsControls name="columns_controls"/>
          <filters name="listing_filters" />
          <paging name="listing_paging"/>
          </listingToolbar>
          </listing>


          Replace: MyVendorMyModule and my_product_listing with your namespace.



          Also there is another way of add the store selector in the grid i.e via filters same as catalog product grid.






          share|improve this answer



















          • 1




            Thanks a lot it's working!!
            – Rutvee Sojitra
            1 hour ago










          • Also, Do you want to filter products on the basis of the selected store? Because that's another thing to be done.
            – Milind Singh
            1 hour ago










          • yes i want to do
            – Rutvee Sojitra
            1 hour ago










          • @RutveeSojitra I have updated the code. hope it helps
            – Milind Singh
            59 mins ago















          up vote
          4
          down vote



          accepted







          up vote
          4
          down vote



          accepted






          Update your layout as below.



          <?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="MagentoBackendBlockStoreSwitcher" 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">0</argument>
          <argument name="switch_store_groups" xsi:type="string">0</argument>
          <argument name="switch_store_views" xsi:type="string">1</argument>
          </arguments>
          </block>
          </referenceContainer>
          <referenceContainer name="content">
          <uiComponent name="my_product_listing"/>
          </referenceContainer>
          </body>
          </page>


          To filter products you need to change the UI component for the Bookmark.



          Create a UI component class as :



          namespace MyVendorMyModuleComponent;

          use MagentoFrameworkViewElementUiComponentContextInterface;
          use MagentoUiApiBookmarkManagementInterface;
          use MagentoUiApiBookmarkRepositoryInterface;

          class Bookmark extends MagentoUiComponentBookmark
          {
          public function __construct(
          ContextInterface $context,
          CedAmazonApiProfileRepositoryInterface $profile,
          BookmarkRepositoryInterface $bookmarkRepository,
          BookmarkManagementInterface $bookmarkManagement,
          array $components = ,
          array $data =
          ) {
          parent::__construct($context, $bookmarkRepository, $bookmarkManagement, $components, $data);
          $this->profile = $profile;
          }

          /**
          * Register component
          *
          * @return void
          */
          public function prepare()
          {
          $namespace = $this->getContext()->getRequestParam('namespace', $this->getContext()->getNamespace());
          $config = ;
          if (!empty($namespace)) {
          $storeId = $this->getContext()->getRequestParam('store');

          if (empty($storeId)) {
          $storeId = $this->getContext()->getFilterParam('store_id');
          }

          $bookmarks = $this->bookmarkManagement->loadByNamespace($namespace);
          /** @var MagentoUiApiDataBookmarkInterface $bookmark */
          foreach ($bookmarks->getItems() as $bookmark) {
          if ($bookmark->isCurrent()) {
          $config['activeIndex'] = $bookmark->getIdentifier();
          }

          $config = array_merge_recursive($config, $bookmark->getConfig());

          if (!empty($storeId)) {
          $config['current']['filters']['applied']['store_id'] = $storeId;
          }
          }
          }

          $this->setData('config', array_replace_recursive($config, $this->getConfiguration($this)));

          parent::prepare();

          $jsConfig = $this->getConfiguration($this);
          $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
          }
          }


          Add the Bookmark UI component in your UI grid 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">
          <listingToolbar name="listing_top">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="sticky" xsi:type="boolean">true</item>
          <item name="template" xsi:type="string">ui/grid/toolbar</item>
          </item>
          </argument>
          <bookmark name="bookmarks" class="MyVendorMyModuleComponentBookmark">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/bookmarks/bookmarks</item>
          <item name="storageConfig" xsi:type="array">
          <item name="saveUrl" xsi:type="url" path="mui/bookmark/save"/>
          <item name="deleteUrl" xsi:type="url" path="mui/bookmark/delete"/>
          <item name="namespace" xsi:type="string">my_product_listing</item>
          </item>
          </item>
          </argument>
          </bookmark>
          <columnsControls name="columns_controls"/>
          <filters name="listing_filters" />
          <paging name="listing_paging"/>
          </listingToolbar>
          </listing>


          Replace: MyVendorMyModule and my_product_listing with your namespace.



          Also there is another way of add the store selector in the grid i.e via filters same as catalog product grid.






          share|improve this answer














          Update your layout as below.



          <?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="MagentoBackendBlockStoreSwitcher" 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">0</argument>
          <argument name="switch_store_groups" xsi:type="string">0</argument>
          <argument name="switch_store_views" xsi:type="string">1</argument>
          </arguments>
          </block>
          </referenceContainer>
          <referenceContainer name="content">
          <uiComponent name="my_product_listing"/>
          </referenceContainer>
          </body>
          </page>


          To filter products you need to change the UI component for the Bookmark.



          Create a UI component class as :



          namespace MyVendorMyModuleComponent;

          use MagentoFrameworkViewElementUiComponentContextInterface;
          use MagentoUiApiBookmarkManagementInterface;
          use MagentoUiApiBookmarkRepositoryInterface;

          class Bookmark extends MagentoUiComponentBookmark
          {
          public function __construct(
          ContextInterface $context,
          CedAmazonApiProfileRepositoryInterface $profile,
          BookmarkRepositoryInterface $bookmarkRepository,
          BookmarkManagementInterface $bookmarkManagement,
          array $components = ,
          array $data =
          ) {
          parent::__construct($context, $bookmarkRepository, $bookmarkManagement, $components, $data);
          $this->profile = $profile;
          }

          /**
          * Register component
          *
          * @return void
          */
          public function prepare()
          {
          $namespace = $this->getContext()->getRequestParam('namespace', $this->getContext()->getNamespace());
          $config = ;
          if (!empty($namespace)) {
          $storeId = $this->getContext()->getRequestParam('store');

          if (empty($storeId)) {
          $storeId = $this->getContext()->getFilterParam('store_id');
          }

          $bookmarks = $this->bookmarkManagement->loadByNamespace($namespace);
          /** @var MagentoUiApiDataBookmarkInterface $bookmark */
          foreach ($bookmarks->getItems() as $bookmark) {
          if ($bookmark->isCurrent()) {
          $config['activeIndex'] = $bookmark->getIdentifier();
          }

          $config = array_merge_recursive($config, $bookmark->getConfig());

          if (!empty($storeId)) {
          $config['current']['filters']['applied']['store_id'] = $storeId;
          }
          }
          }

          $this->setData('config', array_replace_recursive($config, $this->getConfiguration($this)));

          parent::prepare();

          $jsConfig = $this->getConfiguration($this);
          $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig);
          }
          }


          Add the Bookmark UI component in your UI grid 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">
          <listingToolbar name="listing_top">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="sticky" xsi:type="boolean">true</item>
          <item name="template" xsi:type="string">ui/grid/toolbar</item>
          </item>
          </argument>
          <bookmark name="bookmarks" class="MyVendorMyModuleComponentBookmark">
          <argument name="data" xsi:type="array">
          <item name="config" xsi:type="array">
          <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/bookmarks/bookmarks</item>
          <item name="storageConfig" xsi:type="array">
          <item name="saveUrl" xsi:type="url" path="mui/bookmark/save"/>
          <item name="deleteUrl" xsi:type="url" path="mui/bookmark/delete"/>
          <item name="namespace" xsi:type="string">my_product_listing</item>
          </item>
          </item>
          </argument>
          </bookmark>
          <columnsControls name="columns_controls"/>
          <filters name="listing_filters" />
          <paging name="listing_paging"/>
          </listingToolbar>
          </listing>


          Replace: MyVendorMyModule and my_product_listing with your namespace.



          Also there is another way of add the store selector in the grid i.e via filters same as catalog product grid.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 36 mins ago

























          answered 1 hour ago









          Milind Singh

          424113




          424113








          • 1




            Thanks a lot it's working!!
            – Rutvee Sojitra
            1 hour ago










          • Also, Do you want to filter products on the basis of the selected store? Because that's another thing to be done.
            – Milind Singh
            1 hour ago










          • yes i want to do
            – Rutvee Sojitra
            1 hour ago










          • @RutveeSojitra I have updated the code. hope it helps
            – Milind Singh
            59 mins ago
















          • 1




            Thanks a lot it's working!!
            – Rutvee Sojitra
            1 hour ago










          • Also, Do you want to filter products on the basis of the selected store? Because that's another thing to be done.
            – Milind Singh
            1 hour ago










          • yes i want to do
            – Rutvee Sojitra
            1 hour ago










          • @RutveeSojitra I have updated the code. hope it helps
            – Milind Singh
            59 mins ago










          1




          1




          Thanks a lot it's working!!
          – Rutvee Sojitra
          1 hour ago




          Thanks a lot it's working!!
          – Rutvee Sojitra
          1 hour ago












          Also, Do you want to filter products on the basis of the selected store? Because that's another thing to be done.
          – Milind Singh
          1 hour ago




          Also, Do you want to filter products on the basis of the selected store? Because that's another thing to be done.
          – Milind Singh
          1 hour ago












          yes i want to do
          – Rutvee Sojitra
          1 hour ago




          yes i want to do
          – Rutvee Sojitra
          1 hour ago












          @RutveeSojitra I have updated the code. hope it helps
          – Milind Singh
          59 mins ago






          @RutveeSojitra I have updated the code. hope it helps
          – Milind Singh
          59 mins ago




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f252738%2fhow-to-add-storeview-switcher-in-custom-admin-grid-which-created-using-ui-compon%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Eastern Orthodox Church

          Zagreb

          Understanding the information contained in the Deep Space Network XML data?