2

In Magento 2.2.6, modifying customer listing to add custom columns, setting to set a default visibility is not being taken into account. It doest not matter if it is set to true or false. It does not make any change.

The is working, since we are able to change column name. For example, see "Web Site 2" column name.

<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">
    <column name="mod_cardcode" class="Mod\CustomerCrm\Ui\Component\Listing\Column\Cardcode">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">text</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="filter" xsi:type="string">text</item>
                <item name="label" translate="true" xsi:type="string">Company customer code</item>
                <item name="sortOrder" xsi:type="number">25</item>
            </item>
        </argument>
    </column>      
    <column name="group_id" component="Magento_Ui/js/grid/columns/select" sortOrder="50">
        <settings>
            <visible>false</visible>
        </settings>
    </column>         
    <column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date" sortOrder="100">
        <settings>
            <visible>false</visible>
        </settings>
    </column>
    <column name="website_id" class="Magento\Customer\Ui\Component\Listing\Column\Websites" component="Magento_Ui/js/grid/columns/select" sortOrder="110">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="visible" xsi:type="boolean">false</item>
                <item name="label" translate="true" xsi:type="string">Web Site 2</item>
            </item>
        </argument>
    </column>
    <column name="confirmation" class="Magento\Customer\Ui\Component\Listing\Column\Confirmation" sortOrder="130">
        <settings>
            <visible>false</visible>
        </settings>
    </column>        
</columns>

enter image description here

0

Try this:

<column name="website_id" class="Magento\Customer\Ui\Component\Listing\Column\Websites" component="Magento_Ui/js/grid/columns/select" sortOrder="110">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="visible" xsi:type="boolean">false</item>
            <item name="label" translate="true" xsi:type="string">Web Site 2</item>
            <item name="statefull" xsi:type="array">
                <item name="visible" xsi:type="boolean">false</item>
            </item>
        </item>
    </argument>
</column>

Keep in mind that all applied changes stored inside bookmarks table, so check it with another custom column. If you want to hide general column (from the base Magento setup) you should make modifications in the ui_bookmark table directly. Data in that table stored for each listing and looks like this:

ui_bookmark table data

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.