Magento, different background color for group of rows on backend grid

后端 未结 3 1572
小蘑菇
小蘑菇 2020-12-22 04:34

On a backend admin page with a grid I need to change the background color for groups of rows. Not alternate color row by row as default but coloring groups according to a kn

3条回答
  •  情歌与酒
    2020-12-22 05:12

    The answers above are good, but sometimes you want to do the same thing without creating a new file.
    Here is another way to achieve the same result remaining in the grid file.

    $this->addColumn('collision_type', array(
          'header'  => $helper->__('Collision'),
          'align'   => 'center',
          'index'   => 'collision_type',
          'type'    => 'action',
          'frame_callback' => [$this, '_formatCell']
    ));
    

    then in the same file

    public function _formatCell($value, Varien_Object $row, Mage_Adminhtml_Block_Widget_Grid_Column $column)
    {
        $value =  $row->getData($column->getIndex());
        return '
    '.$value.'
    '; }

提交回复
热议问题