There are quite some tutorials explaining how to add a custom admin grids. Unfortunately some of them are missing the fact that sorting and filtering functionality require additional controller action.
This action is specified by getGridUrl()
method of your grid class. The pitfall is that this method is defined in Mage_Adminhtml_Block_Widget_Grid
so if you forget to override it you may notice it until you try to sort or filter your grid. Mage_Adminhtml_Block_Widget_Grid::getGridUrl()
returns $this->getCurrentUrl()
which doesn't make much sense. So obvious move would be to override it with something like this:
public function getGridUrl()
{
return $this->getUrl('*/*/grid', array('_current'=>true));
}
The simple controller action that will just render a layout will wrap things up:
public function gridAction()
{
$this->loadLayout();
$this->renderLayout();
}
getGridUrl()
method inside of yourEdit/Tab/[Tabname].php
and if yes then what is the first parameter ofgetUrl()
method there?getGridUrl()
and some parameters passed toaddTab()
, like 'class' => 'ajax'