1

我正在开发 magento 1.7 版本。我在 magento admin 中有一个网格。当我单击特定行时,它会在左侧边栏中打开一个表单和两个选项卡。当我单击一个选项卡时,它会在右侧显示一个网格。现在我希望在这个网格中自动选择一个过滤器。

前任。-

http://d.pr/i/UuB4 http://d.pr/i/BN1N

在此,类别应在过滤器中自动选择,以及如何在 _beforeToHtml() 中的 tabs.php 中获取当前行 ID。

我正在为标签使用以下代码

 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();
}

任何帮助将非常感激。

4

1 回答 1

3

您可以使用此代码设置过滤器值 -

$this->setDefaultFilter(array('category'=>3));

其中 3 - 网格的 _prepareCollection() 方法中的类别 ID。

于 2013-12-19T09:56:26.413 回答