I am working on magento 1.7 version. I have a grid in magento admin. When I click on a particular row it opens a form and two tabs in left sidebar. when I click on one tab it is displaying a grid in right side. Now I want that in this grid a filter should be auto selected.
Ex.-
http://d.pr/i/UuB4 http://d.pr/i/BN1N
In this, category should be auto selected in filter and how to get current row id in tabs.php in _beforeToHtml().
I am using following code for tabs
protected function _beforeToHtml() {
$this->addTab('form_section', array(
'label' => Mage::helper('test')->__('Category'),
'title' => Mage::helper('test')->__('Category'),
'content' => $this->getLayout()->createBlock('test/adminhtml_category_edit_tab_form')->toHtml(),
));
$this->addTab('tab_section', array(
'label' => Mage::helper('test')->__('Images'),
'title' => Mage::helper('test')->__('Images'),
'content' => $this->getLayout()->createBlock('test/adminhtml_book_grid')
->toHtml()
));
return parent::_beforeToHtml();
}
any help would be much appreciated.
you can use this code to set the filter value -
$this->setDefaultFilter(array('category'=>3));
where 3 - category id in your grid's _prepareCollection() method.