How to Remove Column from Admin Grid Dynamically in Magento 2

How to Remove Column from Admin Grid Dynamically in Magento 2

Magento 2 CMS facilitates admin users to customize the default features in order to ease the task of administrating the Magento 2 store and effectively manage the orders and customers.

For instance, the admin can add a custom column in products grid.

Now, what if the admin wants to remove column from the admin grid dynamically in Magento 2?

It may happen that when a custom module is created in Magento 2, it requires adding a custom column in the admin grid. And when the custom module is disabled, one would want to remove that custom column too.

In that scenario, you need to use the below solution to remove column from admin grid dynamically in Magento 2.

Method to Remove Column From Admin Grid in Magento 2 Dynamically:

  1. Use the below code in the ui_component_file.xml file at app/code/Meetanshi/CustomerLogin/view/adminhtml/ui_component

  2. Use the below code in the OrderActions.php file at app/code/Meetanshi/CustomerLogin/Ui/Component/Listing/Column

That’s it.

If you still face any problem, in removing the column from Magento 2 admin panel, do mention them in the Comments section below.

I would be happy to help.

Don’t forget to share this solution with Magento Community via social media.

Thank you.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

5
(based on 2 Reviews)

Yash is a Magento Developer at Meetanshi. He loves playing computer games and watching action movies. For brain exercise, he likes to play Chess.

Leave a reply:

Your email address will not be published.