Home » Magento10 September 2016

Magento: Add new column to the end or after any column of admin grid

This article shows, how you can add a new column at the end of the admin grid or after any column of the admin grid in Magento 1.x.

Suppose, you have a custom module and you need to add a column to product grid or order grid, etc. For this, you need to rewrite that particular grid block with your custom module’s block grid class.

In your custom block grid class, you have _prepareColumns() function where you specify the columns you need to show in the grid.

Here, I will be showing how you can add a column to an existing grid without copying all the columns adding code from parent grid class.

Add a column to the end of the grid

Suppose, the column you need to add is named myNewColumn. We can just call the parent _prepareColumns() function and then add the new column and return it.

Add a column after any particular grid column

Suppose, the column you need to add is named myNewColumn. And, you need to add this column after a particular column of the existing grid. Suppose, that column name is xyz. Now, you need to add your new column after column ‘xyz’. This can be done using addColumnAfter() function.

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Hi Mukesh,
    I love all the tips that you had shared within the Article. Very Helpful Information about Magento admin grid.
    Thanks