1

I added a tab to customer edit in admin magento, it's a grid. I used

$this->setUseAjax(true);

but when i filter, it's just loading and not show results. I have getGridUrl() in Custom.php:

public function getGridUrl()
    {
        return $this->getUrl('*/*/grid', array('_current'=> true));
    }

And i have controller with grid action:

public function gridAction()
    {
        $this->loadLayout();
        $this->getResponse()->setBody(
            $this->getLayout()->createBlock('mymodule/adminhtml_customer_edit_tab_custom')->toHtml()
        );
    }

but still not filter

  • What is the response from the ajax call? If you see the loading gif, there must be a response. – Marius Feb 25 '14 at 11:59
  • yeah, it just loading with loading gif, and response list customers from page manage customers, but it still loading and loading – rocky Feb 25 '14 at 12:01
  • 2
    If this is a new tab in the customer edit form then you shouldn't use '*/*/grid' as your grid url. This will make the request to the customer admin controller. Put your own controller in there. Something like '*/mycontroller/grid' – Marius Feb 25 '14 at 12:07
3

Yeah, i found solution following by marius's hint. My controller

Mymodule/controllers/Adminhtml/TestController.php

<?php

class Myextension_Mymodule_Adminhtml_TestController{

    public function gridAction()
    {
        $this->loadLayout();
        $this->getResponse()->setBody(
            $this->getLayout()->createBlock('mymodule/adminhtml_customer_edit_tab_custom')->toHtml()
        );
    }
}

My config.xml:

<admin>
 <routers>
    <adminhtml>
       <args>
        <modules>
          <myextension_mymodule before="Mage_Adminhtml">Myextension_Mymodule_Adminhtml</myextension_mymodule>
        </modules>
       </args>
    </adminhtml>
 </routers>
</admin>

Change

public function getGridUrl()
    {
        return $this->getUrl('*/*/grid', array('_current'=> true));
    }

To

public function getGridUrl()
        {
            return $this->getUrl('*/test/grid', array('_current'=> true));
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.