我在 magento 中创建了一个自定义模块。当我单击网格时,它会移动到编辑表单,我可以在其中看到三个选项卡,例如 tab1、tab2、tab3。默认情况下选择 tab1。现在我想在网格上添加一个链接,当客户单击该链接浏览器将用户重定向到 tab3。我该怎么做。我的标签代码如下:
protected function _beforeToHtml()
{
$this->addTab('form_section', array(
'label' => Mage::helper('mymodule')->__('Information'),
'title' => Mage::helper('mymodule')->__('Information'),
'content' => $this->getLayout()->createBlock('mymodule/adminhtml_mymodule_edit_tab_form')->toHtml(),
));
$this->addTab('form_section1', array(
'label' => Mage::helper('mymodule')->__(' Management'),
'title' => Mage::helper('mymodule')->__('Management'),
'content' => $this->getLayout()->createBlock('mymodule/adminhtml_mymodule_edit_tab_managment')->toHtml(),
));
$this->addTab('form_section2', array(
'label' => Mage::helper('mymodule')->__('Results'),
'title' => Mage::helper('mymodule')->__('Results'),
'content' => $this->getLayout()->createBlock('mymodule/adminhtml_mymodule_edit_tab_result')->toHtml(),
));
return parent::_beforeToHtml();
}
我的链接代码类似于网格列表页面上的链接代码。<a class="viewit" href="http://localhost/project/index.php/mymodule/adminhtml_mymodule/view/id/4/key/83063e416ef7f9cfb7825d01e4519293/">View</a>
.我的控制器功能为:
public function viewAction()
{
$this->loadLayout();
$block = $this->getLayout()->createBlock('mymodule/adminhtml_mymodule_edit_tab_result');
// $this->_addContent($this->getLayout()->createBlock('mymodule/adminhtml_mymodule_edit_tab_result'))
//->_addLeft($this->getLayout()->createBlock('mymodule/adminhtml_mymodule_edit_tabs'));
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}