1

I have created a custom module with Module Creator (v 1.7).
Have one multi-select admin form field.
As the multiselect field on submitting gives array , the same value (i.e Array) is stored in database.
To avoid this on saving the submitted value , I just manipulated the code by storing it in e.g a,b,c form.
Through this the data is saved successfully.
Now in grid , I want to filter it , as we have for Status part [1=>Enabled 2=>Disabled].
please suggest How would I achieve this .

4

1 回答 1

2

看看magentofilter_condition_callback选项

$this->addColumn('categories', array(
                   ....                      
                   'filter_condition_callback' => array($this, '_applyMyFilter'),
                    ..
                 )
 );

 protected function _filterCategoriesCondition($collection, $column)
 {
     if (!$value = $column->getFilter()->getValue()) {
         return;
     }

     $this->getCollection()->addFieldToFilter('categories', array('finset' => $value));
 }

于 2013-05-17T19:14:19.710 回答