2017-06-20 31 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

我的榮幸!!!! –