I have a table with many colomns. It has a big lable strings and smal data strings, like ‘Average usage time’ and ’55’,
| Average usage time | ______________________ | 55|
so i want to show label in a few lines, like
| Average| | usage| | time| | _______| | 55 |
to fit table into screen. Problem is that DataColumn ignore both ‘n’ symbol and br tags in label. Is there any way to do this?
DataColumn example:
[ 'attribute' => 'avg_usage_time', 'label' => 'Average <br>usage time', 'vAlign'=>'middle', 'content' => function($model) { return number_format($model['avg_usage_time'], 0, '.', ' '); }, 'pageSummary' => function ($summary, $data, $widget) { return (isset($summary) && is_numeric($summary)) ? number_format($summary, 0, '.', ' ') : 0; }, ],
Advertisement
Answer
Here is your solution please add type attribute.
[ 'attribute' => 'avg_usage_time', 'label' => 'Average <br>usage time', 'type' => 'raw' 'vAlign'=>'middle', 'content' => function($model) { return number_format($model['avg_usage_time'], 0, '.', ' '); }, 'pageSummary' => function ($summary, $data, $widget) { return (isset($summary) && is_numeric($summary)) ? number_format($summary, 0, '.', ' ') : 0; }, ],
may it helps you. please add this 'type' => 'raw'
in attribute it allows to use html.