代码
我的奏鸣曲管理类代码:
class UsersAdmin extends AbstractAdmin
{
.....
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('getSummaryTimeInGame','string',[
'label' => 'Summary time in game',
'template' =>'AdminBundle::get_summary_time_in_game.html.twig'
])
->add('getPercentTasksDone', 'string', [
'label' => 'Percents tasks done',
'template' => 'AdminBundle::get_percent_tasks_done.html.twig'
])
}
public function getExportFields()
{
return [
'Name' => 'name',
'Surname' => 'surname',
'Summary time in game' => 'getSummaryTimeInGame',
'Percents tasks done' => 'getPercentTasksDone',
];
}
.....
}
问题
字段 'getSummaryTimeInGame' 和 'getPercentTasksDone' 在数据网格列表视图中可见,但在导出到 XLS 时,它们是空白的。
如何在 XLS 导出中正确列出这些字段?