1

I would like to remove the default columns control component in product_listing.xml, I tried with this code but it's not working :

 <columnsControls name="columns_controls">
     <argument name="data" xsi:type="array">
         <item name="remove" xsi:type="boolean">true</item>
     </argument>
 </columnsControls>

Thanks !

2 Answers 2

1

The visible attribute has no effect for the columnControls component, but you can use a "hacky" way which affects the render function:

<?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">
        <columnsControls name="columns_controls">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="displayArea" xsi:type="boolean">false</item>
                </item>
            </argument>
        </columnsControls>
    </listingToolbar>
</listing>

Exploration:

The columnControls component (magento/module-ui/view/base/web/js/grid/controls/columns.js) added to the listingToolbar component, which have a default template magento/module-ui/view/base/web/templates/grid/toolbar.html where the dataGridActions region should be rendered during a listing loading process. Our columnControls component assigned to that region by default in the own code:

defaults: {
    template: 'ui/grid/controls/columns',
        // ...
        viewportSize: 18,
        displayArea: 'dataGridActions', // <<< Here it is 
        columnsProvider: 'ns = ${ $.ns }, componentType = columns',
        // ...
    },
    // ...
},

So, if we change the displayArea to the nothing it will not be displayed.

0
0

U can just comment this lines :

 <columnsControls name="columns_controls">
     <argument name="data" xsi:type="array">
         <item name="remove" xsi:type="boolean">true</item>
     </argument>
 </columnsControls>

Or just remove them.

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.