This may sound like an easy task but at the moment I'm just too blind to see how to add attributes like style to the generated header columns in my configureListFields without overriding the list template:
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('supplierBranch.company.name', null, array(
'label' => 'list.fields.supplier_branch',
'template' => 'AppBundle:ContractAdmin:list__supplier_branch.html.twig',
'attr' => array('style' => 'width:400px;'),
'class' => 'foo'
));
}
This does not change the cell and it wouldn't be helpful since the style e.g. width needs to be applied to the header cell.
<th class="sonata-ba-list-field-header-text sonata-ba-list-field-header-order-asc "> Supplier Branch </th>
...
<td class="sonata-ba-list-field sonata-ba-list-field-text" objectid="6323">...</td>
:+1:
I'm facing the same problem.
I add "header_class" =>"col-md-5" like it is explained in the documentation, but like @webdevilopers , nothing change. (https://sonata-project.org/bundles/admin/master/doc/reference/action_list.html#visual-configuration)
According to https://sonata-project.org/bundles/admin/master/doc/reference/action_list.html#visual-configuration you have to use header_style, so you would end up with:
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('supplierBranch.company.name', null, array(
'label' => 'list.fields.supplier_branch',
'template' => 'AppBundle:ContractAdmin:list__supplier_branch.html.twig',
'header_style' => 'width:400px;',
'header_class' => 'foo'
));
}
That actually worked for me.
Can you confirm this indeed does work for you @QuentinPolantis ? Then we can close this issue.
Hello,
Yes, this issue seems to have been fixed now and it's working for me as well.
Thanks for figuring that one out.
Most helpful comment
According to https://sonata-project.org/bundles/admin/master/doc/reference/action_list.html#visual-configuration you have to use
header_style, so you would end up with:That actually worked for me.