Magento – Magento 2: How to hide a column from an admin grid

admingridmagento2uicomponent

Using 2.1.3, is there a way to hide an entire column from a UI component admin grid? I found Magento2 Add css class to admin ui grid column, and that hides the column, but not the column header (misaligning the grid columns).

Best Answer

use <item name="visible" xsi:type="boolean">false</item> in the config node of data argument when declaring column

eg.

<column name="created_at">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="resizeEnabled" xsi:type="boolean">false</item>
            <item name="filter" xsi:type="string">dateRange</item>
            <item name="sorting" xsi:type="string">desc</item>
            <item name="label" xsi:type="string" translate="true">Created at</item>
            <item name="sortOrder" xsi:type="number">120</item>
            <item name="visible" xsi:type="boolean">false</item>
        </item>
    </argument>
</column>

the only issue that the filter won't showing until you switch the column back to visible