5

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 

4 Answers 4

4

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>
2
  • This should be the accepted answer, however I could use additional context / explanation to help those less familiar with what this file is and what is happening. Nov 22, 2020 at 15:23
  • Ok thanks for your feedback. Nov 24, 2020 at 5:10
2

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

enter image description here

4
  • I wish to remove the column, not hide it. Apr 4, 2018 at 6:21
  • @vitoriodachef: Have you solution?
    – B.K
    Nov 5, 2018 at 14:17
  • @kranthi check the accepted answer Nov 6, 2018 at 9:09
  • @vitoriodachef: i want to remove it grammatically(Need to remove column condition based).
    – B.K
    Nov 6, 2018 at 9:23
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

2
  • I tried your code, but it doesn't worked
    – senthil
    Nov 30, 2018 at 9:57
  • @senthil It has been a long time since I looked into this. Yet I remember it working. You can try and make another thorough check to see that all steps were correctly applied. Also check that cache is cleared. Dec 3, 2018 at 11:21
1

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.

3
  • So I didn't go directly in the database with the hammer. I've used the customer setup and did a update attribute with the changes you suggested. Also did a reindex. It's not working. It's still there. Apr 4, 2018 at 7:10
  • Please check in the database table whether your setup script made any changes in the table or not? Apr 4, 2018 at 7:18
  • I confirm that changes were applied Apr 4, 2018 at 7:21

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.