I have created a custom module that shows data in a grid. How do I move the 'add new rate' button from the module header to the grid? I have not tried anything yet as I have no idea where to start.

Move button

  • it is not as simple as that. they belong to different objects/instances, moving that button will result in fatal error. Why do you want to move that button below?
    – Shathish
    Commented Jul 18, 2013 at 7:55
  • Aesthetics. I think it would look neater inline with the other buttons. If it cannot be done, then there's no problem :) Commented Jul 18, 2013 at 9:11

1 Answer 1


Even if I don't see the point (but maybe I'm not that artistic) this can be done easily. First you need to remove the add button from the grid container block. This should be the block: {Namespace}/{Module}/Block/Adminhtml/{Entity}.php. At the end of the __construct method add this line:


Now you need to add a button near the search button. For this you should add a method called getMainButtonsHtml in your grid block. This is {Namespace}/{Module}/Block/Adminhtml/{Entity}/Grid.php

public function getMainButtonsHtml()
    $html = parent::getMainButtonsHtml();//get the parent class buttons
    $addButton = $this->getLayout()->createBlock('adminhtml/widget_button') //create the add button
            'label'     => Mage::helper('adminhtml')->__('Add'),
            'onclick'   => "setLocation('".$this->getUrl('*/*/new')."')",
            'class'   => 'task'
    return $addButton.$html;

That's it. Happy button aligning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.