ThaDafinser / ZfcDatagrid

New package available here (see website)
https://github.com/zfc-datagrid/zfc-datagrid/
MIT License
87 stars 57 forks source link

JqGrid Rendrer overwrite default Action column value #222

Closed popovserhii closed 7 years ago

popovserhii commented 8 years ago

I try add formatter to custom column Action

$fmtr = new Column\Formatter\Link();
$fmtr->setAttribute('class', 'pencil-edit');
$fmtr->setLink('/spares-ras/products/' . $fmtr->getColumnValuePlaceholder($colId));

$action = new Column\Action('edit');
$action->setLabel(' ');
$action->setTranslationEnabled();
$action->setFormatters([$fmtr]);
$grid->addColumn($action);

but on #L211-L220 my value overwrite with empty value because I don't add any action through $action->addAction();. This can be fixed if add if statement something like this

...
} elseif ($column instanceof Column\Action) {
    /* @var $column \ZfcDatagrid\Column\Action */

    if ($columnActions = $column->getActions()) {
        $actions = [];
        foreach ($columnActions as $action) {
            /* @var $action \ZfcDatagrid\Column\Action\AbstractAction */
            if ($action->isDisplayed($row) === true) {
                $action->setTitle($this->getTranslator()->translate($action->getTitle()));
                $actions[] = $action->toHtml($row);
            }
        }
        $row[$column->getUniqueId()] = implode(' ', $actions);
    }
}
...
ThaDafinser commented 7 years ago

This issue was moved to zfc-datagrid/zfc-datagrid#29