Add a custom highlight to the magenta grid

I am trying to add a custom dropdown using (select / options) in my magento grid, but this will not work, I tried using

$this->addColumn('dropdown', array(
'header' => Mage::helper('catalog')->__('Dropdown'),
'filter'    => false,
'sortable'  => false,
'type'=> 'options',
'options' => array('First'=>'firstvalue', 'second' =>'secondvalue')
));

I do not use the value from the database, but from the API, first I want to display this select dropdown menu on my grid, but all I see is empty space.
Thanks.

EDIT:

Example

Actually, I need to make the first line with a drop-down list, and the second line - what I get from the code that I provided.
I can add a link such as a "view" column, but it doesn’t work for the dropdown menu

+4
source share
2

, :

:

$this->addColumn('dropdown', array(
    'header' => Mage::helper('catalog')->__('dropdown'),
    'filter'    => false,
    'sortable'  => false,
    'index' => 'stores',
    'type' => 'select',
    'values' => array('First'=>'firstvalue', 'second' =>'secondvalue')
));

,

:

$this->addColumn('dropdown', array(
    'header' => Mage::helper('catalog')->__('dropdown'),
    'filter'    => false,
    'sortable'  => false,
    'index' => 'stores',
    'renderer' => 'Module_ModuleName_Block_Adminhtml_Renderer_Dropdown',
));

Dropdown.php Modulename\Block\Adminhtml\Renderer\ :

<?php
class Module_Modulename_Block_Adminhtml_Renderer_Dropdown extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{

public function render(Varien_Object $row) {
    $html = '<select>';
    $html .= '<option value="First">First value</option>';
    $html .= '<option value="Second">Second value</option>';
    $html .= '</select>';
    return $html;
  }
}

Module, Modulename Dropdown , .

+3

, api , script . addColumn ( ) cron, api, modifyColumn ( 5 )

api , .

, !

+1

Source: https://habr.com/ru/post/1615731/


All Articles