Answers:
在您的自定义模块中编辑grid.php文件,
默认,
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);
}
将代码更改为
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);
}
您需要将您的过滤器值base64_encoded传递给相应的控制器。过滤器值由处理Mage_Adminhtml_Block_Widget_Grid::_prepareCollection()
。
该值首先被解码,然后在会话中设置:
$data = $this->helper('adminhtml')->prepareFilterString($filter);
$this->_setFilterValues($data);
我将开始实例化grid.js对象。看看方法doFilter()
和resetFilter()
。