Magento 1.8 – Reset Admin Grid Filter Programmatically

gridmagento-1.8reset-filter

I want to reset the admin grid filter programatically in my custom module.

Best Answer

Edit grid.php file in your custom module,

By default,

public function __construct()
{
  parent::__construct();
  $this->setId('productsGrid');
  // This is the primary key of the database
  $this->setDefaultSort('id'); 
  $this->setDefaultDir('ASC');
  $this->setSaveParametersInSession(true);
  $this->setUseAjax(true);
}

change the code to,

public function __construct()
{
  parent::__construct();
  $this->setId('productsGrid');
  // This is the primary key of the database
  $this->setDefaultSort('id'); 
  $this->setDefaultDir('ASC');
  $this->setSaveParametersInSession(false);
  $this->setUseAjax(true);
}
Related Topic