Thursday, September 27, 2012

Magento : How to use ajax in admin grid

Searching/paging and other operations to all work in admin grid using ajax, is built in functionality, only follow following step
In constructor of Grid.php file, add following lines   
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);

And in Grid.php add the function   
public function getGridUrl()
{
    return $this->getUrl('*/*/grid', array('_current'=>true));
}

And in your ControllerNameContrller.php add the action   
public function gridAction()
{
    $this->loadLayout();
    $this->getResponse()->setBody(
        $this->getLayout()->createBlock('modulename/adminhtml_modelname_grid')->toHtml()
    );
}

1 comment:

  1. The information of this post is truly nice.I believe this web log can invigorate a considerable measure of decent data known with this time.
    Magento ecommerce development india
    Custom magento web development

    ReplyDelete