2017-06-20 59 views
1

What my problem looks likeMagento的1.9定制管理电网负荷里面本身

我有同样的模块2个格(我需要让他们在同一模块中)。 当我点击列的顶部时,网格本身加载它本身。

下面是我的代码: Myname_Blink_Adminhtml_BlinkController

public function keywordsAction() 
{ 
    $this->loadLayout(); 
    $this->_setActiveMenu('blink/keywords'); 
    $this->_addContent($this->getLayout()->createBlock('Myname_Blink_Block_Adminhtml_Keywords_Grid')); 
    $this->renderLayout(); 
} 

我的块文件:Myname_Blink_Block_Adminhtml_Keywords_Grid延伸

class Myname_Blink_Block_Adminhtml_Keywords_Grid extends Mage_Adminhtml_Block_Widget_Grid 
{ 
    public function __construct() 
    { 
     parent::__construct(); 
     $this->setId('keywords_grid'); 
     $this->setDefaultSort('keywords_id'); 
     $this->setDefaultDir('ASC'); 
     //$this->setSaveParametersInSession(true); 
     $this->setUseAjax(true); 
    } 

至于建议这个帖子:Multiple grid in Magento admin

我删除的文件: => Myname_Blink_Block_Adminhtml_Keywords => app \ design \ adminhtml \ default \ default \ layout \ myname \ blink.xml

回答

1

AJAX调用可能会出错。
你尝试这一个: http://davemacaulay.com/fix-issue-with-magento-adminhtml-grid-ajax-call-containing-the-whole-page/

public function keywordsAction() 
{ 
    if($this->getRequest()->isXmlHttpRequest()) { 
     $this->getResponse()->setBody($this->getLayout()->createBlock('Myname_Blink_Block_Adminhtml_Keywords_Grid')->toHtml()); 
     return $this; 
    } 

    $this->loadLayout(); 
    $this->renderLayout(); 
} 

祝你好运!

+0

谢谢!它解决了我的问题。祝你有美好的一天,再次感谢! –

+0

我的荣幸!!!! –