diff --git a/app/code/community/TM/Core/Block/Adminhtml/Module/Grid.php b/app/code/community/TM/Core/Block/Adminhtml/Module/Grid.php index bb051aa..d8c1557 100644 --- a/app/code/community/TM/Core/Block/Adminhtml/Module/Grid.php +++ b/app/code/community/TM/Core/Block/Adminhtml/Module/Grid.php @@ -8,6 +8,9 @@ public function __construct() $this->setId('moduleGrid'); $this->setDefaultSort('release_date'); $this->setDefaultDir('DESC'); + $this->setDefaultFilter(array( + 'version' => TM_Core_Block_Adminhtml_Module_Grid_Filter_Version::VERSION_AVAILABLE + )); $this->setSaveParametersInSession(true); $this->setUseAjax(true); $this->setVarNameFilter('module_filter'); @@ -31,6 +34,7 @@ protected function _prepareColumns() $this->addColumn('version', array( 'header' => Mage::helper('tmcore')->__('Version'), 'align' => 'center', + 'filter' => 'tmcore/adminhtml_module_grid_filter_version', 'renderer' => 'tmcore/adminhtml_module_grid_renderer_version', 'index' => 'version', 'width' => '150px' diff --git a/app/code/community/TM/Core/Block/Adminhtml/Module/Grid/Filter/Version.php b/app/code/community/TM/Core/Block/Adminhtml/Module/Grid/Filter/Version.php new file mode 100644 index 0000000..2093520 --- /dev/null +++ b/app/code/community/TM/Core/Block/Adminhtml/Module/Grid/Filter/Version.php @@ -0,0 +1,39 @@ + null, + self::VERSION_AVAILABLE => 'Available', + self::VERSION_UNAVAILABLE => 'Unavailable', + ); + + protected function _getOptions() + { + $result = array(); + foreach (self::$_options as $code => $label) { + $result[] = array( + 'value' => $code, + 'label' => Mage::helper('adminhtml')->__($label) + ); + } + + return $result; + } + + public function getCondition() + { + switch ($this->getValue()) { + case self::VERSION_AVAILABLE: + return array('neq' => ''); + case self::VERSION_UNAVAILABLE: + return array('eq' => ''); + default: + return null; + } + } +}