我尝试将新列添加到APYDataGridBundle
这是代码:
$source->manipulateRow(
function ($row)
{
/**
* @var $row Row
*/
$row->setField('newColumn', $row->getEntity()->getMorbidity());
return $row;
}
);
但它没有在渲染表上显示,如何显示它?
其余代码:
/**
* @var Grid $grid
*/
$grid = $this->get('grid');
$grid->setSource($source);
$grid->hideColumns(array('id','date_create','hidden''number'));
$grid->hideFilters();
$grid->setActionsColumnTitle(null);
$grid->getColumn('value')->setTitle('price');
$userColumns = array('debtor_name','debtor_type','value', 'sell_price', 'date_sell','date_sell2');
$grid->setColumnsOrder($userColumns);
$myRowAction = new RowAction('see', 'CompanyController_editCompanyPartner', false, '_self');
$grid->addRowAction($myRowAction);
return $grid->getGridRes
ponse( 'meaCoreBundle:基地:grid.html.twig');
答案 0 :(得分:1)
当您需要添加整个列时,您只需添加一个字段。尝试:
$grid->addColumn(new TextColumn(['id' => 'newColumn', 'title' => 'Your Title']));