Sorting Admin Grid Fields with AJAX in Magento

Add follwing code into __construct() function in app/code/local/[Name_Space]/[Module_Name]/Block/Adminhtml/[Module_Name]/Grid.php file.

$this->setUseAjax(true);

Now Add following function at last of this file.

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

Now Add following function at last in app/code/local/[Name_Space]/[Module_Name]/controllers/Adminhtml/[Module_Name]Controller.php file.

public function gridAction()
     {
        $this->loadLayout();
        $this->getResponse()->setBody(
               $this->getLayout()->createBlock('[Module_Name]/adminhtml_[Module_Name]_grid')->toHtml()
        );
     }
Advertisements
    • DCM
    • August 18th, 2013

    Hello, where can i find your email?

  1. Thanks . It worked like a charm .

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: