How to Reorder magento admin grid columns in magento 1.5

Magento’s Admin Interface Shows important records in the Grid Structure. Magento allows us to extend the Grid class to add our own custom fields as columns. When adding custom columns usually we place them at the end of the other columns, but sometimes we may need to place the custom column in certain order.
In the below example we will see how to add a custom column (mobile) in manage customers grid and also we will place our custom column in any position without rewriting it i.e manually cut the code and paste it after a particular column.

Step 1 : The Proper way to override a grid class is to create a module and create a subclass for it. But for now copy the file app/code/core/Mage/Adminhtml/Block/Customer/Grid.php to app/code/local/Mage/Adminhtml/Block/Customer/Grid.php

Step 2 : Now we need to add our custom attribute to the collection.

Now if you add an entry like this in the prepare columns method

Suppose if you wish to show your mobile field after the email column, you have to manually change the code and move it after the email column. But magento provides a flexible method call which makes the task simple, you just need to call another method called addColumnAfter.

Step 3: Now the Important step, instead of using addColumn method you can use addColumnAfter method.
The addColumnAfter method accepts three arguments
i) column id i.e mobile (in our case mobile is the attribute code)
ii) array of column properties such as header, type, index(attribute code)
iii) The first 2 arguments are similar to addColumn method. In The third argument specify the column id after which your custom field needs to appear. In our case we want our mobile field to show after email field. so
the third argument will be ’email’.

The Advantage of using this method is we can separately maintain Original columns and custom columns in the
code without mixing each other. i.e we can add our custom columns at the end of the code (for readability)
and still we can change its position.

Compatability: Magento