9

I have created a custom module in backend to display the search results of 'imei' in admin grid.

1) below is the home page to search imei. enter image description here

2) search result page.

enter image description here

3) after searching i enter the value say for example 23 in imei text field search. enter image description here

4)now i going back to home page and searching another value.

enter image description here

5)but now i get no records found, but there is records for that particular search.

enter image description here

since this happens, i have to reset filter on loading collection.

3

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->setUseAjax(true);
}
0

You need to pass your filter value base64_encoded to the corresponding controller. The filter value gets processed by Mage_Adminhtml_Block_Widget_Grid::_prepareCollection().

The value is first decoded and then set in the session:

    $data = $this->helper('adminhtml')->prepareFilterString($filter);
    $this->_setFilterValues($data);

I would start instantiating the grid.js object. Take a look at the methods doFilter() and resetFilter().

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.