4

I want to remove the Select All option from the drop down in the Magento 2 admin product grid. enter image description here

1
4

For this, you have to create your own js which will extend the UI component multi-select js "module-ui/view/base/web/js/grid/columns/multiselect.js".

    <selectionsColumn name="ids">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="indexField" xsi:type="string">id</item>
                <item name="component" xsi:type="string">Vendor_Module/js/grid/columns/multiselect</item>
                <item name="label" xsi:type="string" translate="true">Select</item>
            </item>
        </argument>
    </selectionsColumn>

Now create a js in app/code/Vendor/Module/view/base/web/js/grid/columns/mulitselect.js

define([
  'underscore',
  'mage/translate',
  'Magento_Ui/js/grid/columns/multiselect',
], function (_, $t, Column) {
   'use strict';

   return Column.extend({
      initialize: function () {
          this._super();
          //selectAll and deselectAll are first two options in ui multiselect js
          this.actions.splice(0,2);
      }
   });
});
9
  • hi @Afreen, how can we remove Select all on this page option here May 27 '20 at 13:51
  • just follow the above answer guidelines. you will be to remove "Select All". May 27 '20 at 14:46
  • sorry @Afreen, my typing mistake, I need to remove Select on this page option May 28 '20 at 8:41
  • if you dont want the select feature then you should remove the whole tag of "selectionsColumn". May 28 '20 at 15:18
  • 1
    remove this whole code from your ui component xml <selectionsColumn name="ids"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="indexField" xsi:type="string">id</item> <item name="component" xsi:type="string">Vendor_Module/js/grid/columns/multiselect</item> <item name="label" xsi:type="string" translate="true">Select</item> </item> </argument> </selectionsColumn> May 28 '20 at 15:50
-1

Magento 2 used UI Component to render products grid at admin, you can use CSS to hide from dropdown.

.catalog-product-index .data-grid-multicheck-cell .action-menu > li:first-child { display: none; }
.catalog-product-index .data-grid-multicheck-cell label { pointer-events: none; }
1
  • 1
    using css to hide something is not as per magento standard
    – Gulshan
    Oct 4 '19 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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