Question

How does one remove a given column from customer grid (admin) ?

Edit:

I wish to remove the column not hide it.

Edit 2

Setting the following is not working.

'is_searchable_in_grid' => false,                
'is_used_in_grid' => false,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => false 
Was it helpful?

Solution 2

So for me it was the confirmation(Confirmed email).

I've updated the confirmation attribute setting the following

'is_searchable_in_grid' => false,                
'is_used_in_grid' => false,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => false 

Now this did not work on it's own and I'm not sure that it contributed to my solution, I'm stating it though cause it might be relevant.

What I did was extend the ui_component itself.

etc/module.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Company_Module" setup_version="0.0.2">
        <sequence>
            <module name="Magento_Customer" />
        </sequence>
    </module>
</config>

view/adminhtml/ui_component/customer_listing.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">
    <columns name="customer_columns" class="Magento\Customer\Ui\Component\Listing\Columns">
        <column name="confirmation" class="Magento\Customer\Ui\Component\Listing\Column\Confirmation" sortOrder="130">
            <settings>
                <controlVisibility>false</controlVisibility>
                <dataType>select</dataType>
                <label translate="true">Confirmed email</label>
                <visible>false</visible>
            </settings>
        </column>
    </columns>
</listing>

Note the controlVisibility node. More information about it can be found here

http://devdocs.magento.com/guides/v2.1/ui_comp_guide/components/ui-column.html

OTHER TIPS

After you login and open customer grid, just follow this screenshot

enter image description here

Remove the company column in grid.

view/adminhtml/ui_component/customer_listing.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">
    <columns name="customer_columns" class="Magento\Customer\Ui\Component\Listing\Columns">
       <column name="billing_company">
             <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="componentDisabled" xsi:type="boolean">true</item>
                </item>
            </argument>
        </column>
     </columns>
</listing>

Although, it is not recommended to make changes in the Magento's tables directly, but since Magento does not provide attributes management in the community edition, you can try this solution.

  1. Check the attribute_id in eav_attribute table for the attribute which you want to remove from the grid.
  2. Search for the same attribute_id in customer_eav_attribute table and change the values of is_used_in_grid, is_visible_in_grid, is_filterable_in_grid and is_searchable_in_grid fields to 0.

Let me know if it works for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top