2

I have included a product grid in edit form tab. ( same edit category does ), however when I search the ajax loader doesn't stop and I'm redirected to the main tab.

I can post part of code if needed but I would only if required ( many files involved )

UPDATE:

it looks like the problem is that the param $url passed to the function reload (grid.js) doesn't contains ?isAjax=true

  • Let's debug. Do you have getGridUrl() method inside of your Edit/Tab/[Tabname].php and if yes then what is the first parameter of getUrl() method there? – user487772 Feb 3 '13 at 18:01
  • I have solved, studying magento edit form ( like the product one that contains the related products). Right now I have changed all code so I don't know exactly where the issue was however I would point my finger at the getGridUrl() and some parameters passed to addTab(), like 'class' => 'ajax' – Fra Feb 3 '13 at 19:37
3

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();
}
| improve this answer | |
  • yes I have, in both, the main grid and in the grid contained in the edit form tab – Fra Feb 3 '13 at 9:27
  • please see my edit. – user487772 Feb 5 '13 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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