This is my code:
$this->addColumn(
$key,
array(
header' => Mage::helper('core')->__($key),
'index' => $key,
'filter' => 'adminhtml/widget_grid_column_filter_select',
'sortable' => true,
)
);
I want to get all of the values from my column and put it in the dropdown options values and to filter them. Is there a way to do that ? At the moment I got an empty dropdown.
[UPDATE]
For instance if my values are 2,3,2,3,4,5,6,7 . I want to have in my dropdown the following values: 2,3,4,5,6,7
[UPDATE 2]
I managed to put the values in the dropdown. See My code:
$this->addColumn(
$key,
array(
'header' => Mage::helper('core')->__($key),
'index' => $key,
'filter' => 'adminhtml/widget_grid_column_filter_select',
'sortable' => true,
'renderer' => $render,
'type' => 'options',
'options' => $this->_getOrderType(),
)
);
public function _getOrderType(){
$types = new Varien_Object(array(
"Frontend" => "Frontend",
"AdminPanel" => "AdminPanel"
));
return $types->getData();
}
But my filter doesn't work. If I filter after smth I got an empty grid.
[UPDATE 3]
Update with the render function:
public function render(Varien_Object $row)
{
$value = $this->_getValue($row);
if ($value == ""){
return "Frontend";
}else {
return "AdminPanel";
}
}