I want to hide some columns from customer listing grid. I try to use false in customer_listing.xml, but it doesn't work. And I noticed that some columns (for example "confirmation", "created_in", "billing_full") in magento's ui component xml file have options visible = false but they don't hide in grid. How can I hide this columns? I don't want to disable them, just hide them. Thanks in advance. P.S. I want to change visability from code for all new admin users.
2 Answers
I found the solution. I created before plugin for class vendor/magento/module-ui/Model/BookmarkManagement.php and method loadByNamespace. I created new bookmarks for current customer with my configuration.
Try the bellow code with create custom app/code/Vendor/Module/view/adminhtml/ui_component/customer_listing.xml
file.
It works for me.
<?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_telephone">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</argument>
</column>
<column name="billing_postcode">
<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>
I hope this will help you