magento grid filter
in the grid block file,add function
protected function _addColumnFilterToCollection($column)
{
// Set custom filter for in category flag
if ($column->getId() == 'vip_no') {
$filter = $column->getFilter();
$filterValue = $filter->getValue();
$cond = $column->getFilter()->getCondition();
$field = ( $column->getFilterIndex() ) ? $column->getFilterIndex() : $column->getIndex();
//$this->getCollection()->addFieldToFilter($field, $cond);
$this->getCollection()->getSelect()->where($field."='".$filterValue."'");
var_dump((string)$this->getCollection()->getSelect());
}
else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
this can be rewrite the default grid filter.